You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2023/07/09 12:13:00 UTC
[jira] [Created] (GROOVY-11120) Unexpected error when using static method of class with lower case
Thodoris Sotiropoulos created GROOVY-11120:
----------------------------------------------
Summary: Unexpected error when using static method of class with lower case
Key: GROOVY-11120
URL: https://issues.apache.org/jira/browse/GROOVY-11120
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following class that resides in package named "bar", and its corresponding client.
{code}
package bar;
public class foo {
public static void create(String x) {}
}
// client code
class Main {
static final void test() {
bar.foo.create("fda");
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 3: Apparent variable 'bar' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'bar' but left out brackets in a place not allowed by the grammar.
@ line 3, column 5.
bar.foo.create("fda");
^
1 error
{code}
h3. Expected behavior
Compile successfully
h3. Notes
Tested against master
Test case adapted from the following code that uses the javassist library.
{code}
class Main {
static final void test() throws Exception {
javassist.tools.framedump.main(null);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)