Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.11
-
None
-
OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
Description
I haven't managed to reproduce this in a simple example, but as I'm upgrading my application from groovy 3 to 4 I have run into this situation. I have a class that defines a public static final string like this:
class PublicStaticString { public static final String NONE = "None" }
Its java stub fails to compile with:
error: no suitable constructor found for String(Object) public static final java.lang.String NONE = new java.lang.String((java.lang.Object)null);
I can remove the "public" from the declaration and the class/stub will compile, but now any java class that references that field will fail to compile with:
error: NONE has private access in PublicStaticString selectNoneButton.setText(PublicStaticString.NONE);
The only way I know to fix this is to convert the java class to groovy.
Attachments
Issue Links
- is related to
-
GROOVY-10902 Dynamic constants for primitive types get default value in Java
- Closed