String constants appearing in class files are implicitly interned by the VM at class load time. As such, explicit calls to .intern() are unneeded for these strings, and they can be compared with explicit reference comparisons where we know a constant has been passed in. Audit recent commits adding .intern() and look into whether further use of reference comparisons are safe.
(In reply to comment #0) > String constants appearing in class files are implicitly interned by the VM > at class load time. hharrison: It's part of the bytecode standard
hharrison: Class1 { public static final Sting foo = "some string";} hharrison: Class2 { public string bar = Class1.foo; } sgothel: I see no delta here, since assignment to 'foo' is done after [optional] operation hharrison: As part of the bytecode of class2, the whole string "some string" is inlined, not a ref to Class1.foo
Maybe you can add one test case validating the inlining and intern() magic in TestGLProfile01NEWT, i.e. assertEqual("GL2", GLProfile.GL2) The test is in it's own jar, as GLProfile is.
ffde09410fb78c43bd45d6c5e62606789dced6eb Bug 1059 _and_ version-compat breackage of commit c78ceb642d0ef5bb5bf27ff8ff1495175ee2e983 Commit c78ceb642d0ef5bb5bf27ff8ff1495175ee2e983 changed: - public static final String GL4 = "GL4"; + public static final String GL4 = "GL4".intern(); which is identified by semver as incompatible, due to Bug 1059 (no more inlining of interned string references). +++ Further '.intern()' removals must happen for version 2.3.0 to not break backward binary compatibility.
(In reply to comment #4) > > Further '.intern()' removals must happen for version 2.3.0 > to not break backward binary compatibility. Moved from 2.2.1 -> 2.3.0: <https://jogamp.org/wiki/index.php/SW_Tracking_Report_Objectives_for_the_release_2.3.0>
if we have no activity here anymore, I may close this bug 'in a while'.
keep it open as a reminder