Error: No static property descriptor found

1,280 views
Skip to first unread message

Wayne Radcliffe

unread,
Jul 28, 2015, 6:56:28 PM7/28/15
to gosu-lang
Hello,

I need your help. I'm attempting my first Gosu app. I'm following along the documentation under Advanced Argument Processing. I've replicated the sample class (Args.gs), the sample code (myaction.gsp) and supporting directory structure (C:\gsp\src\test). Running the app at the command prompt: C:\gsp>gosu myaction.gsp -name Wayne -hidden false results in the following error: 

gw.lang.parser.exceptions.ParseResultsException: myaction.gsp

Errors:

No static property descriptor found for property, Hidden, on class, Type<gw.lang
.cli.Args> [line:8 col:21] in
line 7: print("hello " + Args.Name)
line 8: print("you are " + (Args.Hidden ? "hidden" : "visible") + "!!!!")
Expected Type: Object
Line Number: 8  Column: 21

boolean expected. [line:8 col:21] in
line 7: print("hello " + Args.Name)
line 8: print("you are " + (Args.Hidden ? "hidden" : "visible") + "!!!!")
Expected Type: boolean
Line Number: 8  Column: 21



Warnings:

Name in Type<gw.lang.cli.Args> has been deprecated. [line:7 col:18] in
line 6:
line 7: print("hello " + Args.Name)
line 8: print("you are " + (Args.Hidden ? "hidden" : "visible") + "!!!!")
Line Number: 7  Column: 18


        at gw.internal.gosu.parser.ParserBase.verifyParsedElement(ParserBase.jav
a:286)
        at gw.internal.gosu.parser.ParserBase.verifyParsedElement(ParserBase.jav
a:257)
        at gw.internal.gosu.parser.GosuClassParser.parseDefinitions(GosuClassPar
ser.java:466)
        at gw.internal.gosu.parser.GosuClass.compileDefinitionsIfNeeded(GosuClas
s.java:1529)
        at gw.internal.gosu.parser.GosuClass.compileDefinitionsIfNeeded(GosuClas
s.java:1472)
        at gw.internal.gosu.parser.GosuClass.isValid(GosuClass.java:879)
        at gw.internal.gosu.parser.GosuProgram_Proxy.isValid(gw.internal.gosu.pa
rser.GosuProgram_Proxy:2)
        at gw.internal.gosu.parser.GosuProgramParser.parseExpressionOrProgram(Go
suProgramParser.java:190)
        at gw.lang.Gosu.runWithFile(Gosu.java:337)
        at gw.lang.Gosu.start(Gosu.java:99)
        at gw.lang.Gosu.main(Gosu.java:47)

Running java version 1.8.0_51.

Args.gs source
package test
uses gw.lang.cli.*
 
class Args { 
  // String argument
  static var _name : String as Name
  // boolean argument -- no value to set on the command line
  static var _hidden : boolean as Hidden
}

myaction.gsp source
classpath "src"
uses gw.lang.cli.*
uses test.*
 
CommandLineAccess.initialize (Args)
 
print("hello " + Args.Name)
print("you are " + (Args.Hidden ? "hidden" : "visible") + "!!!!")


Thanks for your inputs.

-Wayne

Luca Boasso

unread,
Jul 28, 2015, 9:04:16 PM7/28/15
to gosu...@googlegroups.com
Hello,
the following works for me with Gosu v.1.6.1:

$ ./gosu myaction.gsp -name Luca -hidden
hello Luca
you are hidden!!!!

Given this example

Args.gs source
package test

uses gw.lang.cli.LongName

class Args {

  @LongName("name")

  static var _name : String as Name

  @LongName("hidden")

  static var _hidden : boolean as Hidden

}

myaction.gsp source
classpath "src"

uses test.Args
uses gw.lang.cli.CommandLineAccess

CommandLineAccess.initialize(Args)

 
print("hello " + Args.Name)
print("you are " + (Args.Hidden ? "hidden" : "visible") + "!!!!")


Let me know if you need any help.

Cheers,
Luca

--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gosu-lang+...@googlegroups.com.
To post to this group, send email to gosu...@googlegroups.com.
Visit this group at http://groups.google.com/group/gosu-lang.
For more options, visit https://groups.google.com/d/optout.

example.zip

Jayson Shene

unread,
Jul 29, 2015, 1:09:04 PM7/29/15
to gosu-lang, wayne.r....@gmail.com
Wayne,

I'm new to goso so I thought I'd try to duplicate your issue and learn from it. I am using IntelliJ, Java 8, and the experimental plugin.

I had the same errors as you did. But I noticed the IDE was unhappy with my import:
uses test.*

I changed it to:

uses test.Args

And the errors went away. I returned it to test.* and then changed the previous import to:

uses gw.lang.cli.CommandLineAccess

And again the errors went away. So for some reason you have to have one or the other explicitly listed and not using the *.

After that I was able to run and get a result. But not one I expected. I used the command line arguments:

-name Jayson -hidden false

and added a line to display the Args because I wasn't getting what I expected in the output of the boolean hidden ...

classpath "src"
uses gw.lang.cli.*
uses test.Args

CommandLineAccess.initialize (Args)

print( "CommandLineArgs: " + CommandLineAccess.getRawArgs() )
print("hello " + Args.Name)
print("you are " + ( Args.Hidden ? "hidden" : "visible") + "!!!!")

My results where as follows:

CommandLineArgs: [-name, Jayson, -hidden, false]
hello Jayson
you are hidden!!!!

Notice that even though the -hidden parameter is showing false the result says:

you are hidden!!!!

Still trying to figure that out.

-Jayson

Luca Boasso

unread,
Jul 29, 2015, 7:48:51 PM7/29/15
to gosu...@googlegroups.com, wayne.r....@gmail.com
Hi Jayson,

please use the new api as in the example I sent before.
If you want to keep the old api your changes are correct, previously the unqualified import (uses test.*) was shadowing our Args.gs.
The reason it doesn’t work for you is that you should call the script this way:

luca$  gosu myaction.gsp -name Jayson -hidden
hello Jayson
you are hidden!!!!
luca$  gosu myaction.gsp -name Jayson
hello Jayson
you are visible!!!!

-hidden is a flag, if you put it hidden will be true, otherwise false.

Regards,
Luca



--

Wayne Radcliffe

unread,
Jul 29, 2015, 7:53:52 PM7/29/15
to gosu-lang, luke....@gmail.com
Hi Luca,

Appreciate the feedback. It's working. Thanks again.

-Wayne

Jayson Shene

unread,
Jul 30, 2015, 9:04:06 AM7/30/15
to gosu-lang, wayne.r....@gmail.com, luke....@gmail.com
Luca,

Thanks for the info. I hadn't seen the new api examples and was working off the version Wayne must have been working off of based on the code. I have it working correctly now.

Thanks,
-Jayson 

Sachin Daundkar

unread,
Jul 12, 2016, 5:05:55 AM7/12/16
to gosu-lang
I considered following options before posting this comment here -- 
- I followed all the thing mentioned by Luca to update my code
- I directly used the files provided by Luca
- I used gw.lang.Gosu.* (it works for rawArgs but not for advance command line.)

All the above options failed for me with error 
"gw.lang.cli.CommandLineAccess" is not a valid type. [line:4 col:18] in
line 3: uses test.Args
line 4: uses gw.lang.cli.CommandLineAccess
line 5:
Line Number: 4  Column: 18


Is there anything change in Gosu- 1.13?

I appreciate help from the group memebers

Thanks,
Sachin

Luca Boasso

unread,
Jul 12, 2016, 11:13:53 AM7/12/16
to gosu...@googlegroups.com
Hi Sachin,

Unfortunately CommandLineAccess was deprecated and starting from Gosu 1.9.x it was removed.
rawArgs is the only option provided by default.

Regards,
Luca

--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gosu-lang+...@googlegroups.com.
To post to this group, send email to gosu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages