Announcement Announcement Module
Collapse
No announcement yet.
STS showing ".format" lined-through in editor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS showing ".format" lined-through in editor

    I'm using STS:

    Version: 2.7.2.RELEASE
    Build Id: 201109131000

    with Grails v1.3.7. I'm going through the "Getting Started with Grails - 2nd Ed" doc and in one example the PDF shows adding a taglib that looks like this:

    HTML Code:
    class FooterTagLib {
       def thisYear = {
           out << new Date().format("yyyy")
       } 
    }
    In STS, the ".format" method on Date is showing up with a lined-through font which an exception of:

    HTML Code:
    String org.codehaus.groovy.runtime.DefaultGroovyMethods.format(Date self, String format)
    
    Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
    I ignored this the first time I encountered this when the guide offered up a another date formatting example but this is the second time.

    Curious if anyone knows what this is and means and how the fix.

  • #2
    I tried your example (using STS 2.8.0.RC1 and lates Grails tooling with Grails 1.3.7).

    The 'lined-through' means that the method is deprecated. If you would use a more recent version of Greclipse, you wouldn't actually see this
    because it (correctly) resolved that call to a newer method in the 'DateGroovyMethods' which takes the place of the one in 'DefaultGroovyMethods'.

    The comment about missing source and JavaDoc you see is because the groovy-all jar file that is inside the "Grails Dependencies" doesn't have attached
    source code. That is expected.

    From Grails 2.0.M2 you can select "Grails Tools >> Download Source Jars" to remedy this, but unfortunately that option does not work for Grails 1.3.7.

    However, you can manually attach source jar as follows:
    - download the sources jar (e.g. from here: http://repository.codehaus.org/org/c...ovy-all/1.7.8/)
    - open the "Grails Dependencies" in your project explorer.
    - find "groovy-all-.1.7.8.jar"
    - Right click and select 'properties'
    - add the sources jar under 'Java Source Attachement'

    After you do that, when you hover over the format method, it should give you proper JavaDoc.

    Anyhow, most of these problems are really cosmetic (i.e. glitches in the IDE/Editor presentation only) and shouldn't affect how your code works when you run it.

    So the simplest thing for you to do is probably just to carry on and ignore the strike-through formatting. Alternatively, you can install a newer version of STS, the grails tooling and
    Greclipse to get more accuracy in resolving that particular method call in the editor.

    Kris
    Last edited by Kris De Volder; Oct 6th, 2011, 12:23 PM. Reason: Fix spelling and add missing link

    Comment


    • #3
      Hey Kris,

      Thanks for the reply and information !!

      Comment

      Working...
      X