<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1059</bug_id>
          
          <creation_ts>2014-09-02 18:57:23 +0200</creation_ts>
          <short_desc>AUDIT use of intern for String constants and reference comparisons</short_desc>
          <delta_ts>2023-07-12 01:53:26 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>3.0.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>IN_PROGRESS</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Harvey Harrison">harvey.harrison</reporter>
          <assigned_to name="Harvey Harrison">harvey.harrison</assigned_to>
          <cc>sgothel</cc>
          
          <cf_type>TASK</cf_type>
          <cf_scm_refs>ffde09410fb78c43bd45d6c5e62606789dced6eb</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>4178</commentid>
    <comment_count>0</comment_count>
    <who name="Harvey Harrison">harvey.harrison</who>
    <bug_when>2014-09-02 18:57:23 +0200</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4179</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-02 19:00:55 +0200</bug_when>
    <thetext>(In reply to comment #0)
&gt; String constants appearing in class files are implicitly interned by the VM
&gt; at class load time.  

hharrison: It&apos;s part of the bytecode standard</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4181</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-02 19:28:12 +0200</bug_when>
    <thetext>hharrison: Class1 { public static final Sting foo = &quot;some string&quot;;}
hharrison: Class2 { public string bar = Class1.foo; }
sgothel: I see no delta here, since assignment to &apos;foo&apos; is done after [optional] operation
hharrison: As part of the bytecode of class2, the whole string &quot;some string&quot; is inlined, not a ref to Class1.foo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4182</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-02 19:29:59 +0200</bug_when>
    <thetext>Maybe you can add one test case validating the inlining and intern() magic
in TestGLProfile01NEWT, i.e.
  assertEqual(&quot;GL2&quot;, GLProfile.GL2)

The test is in it&apos;s own jar, as GLProfile is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4184</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-03 15:44:09 +0200</bug_when>
    <thetext>ffde09410fb78c43bd45d6c5e62606789dced6eb

Bug 1059 _and_ version-compat breackage of 
commit c78ceb642d0ef5bb5bf27ff8ff1495175ee2e983
    
    Commit c78ceb642d0ef5bb5bf27ff8ff1495175ee2e983 changed:
      -    public static final String GL4   = &quot;GL4&quot;;
      +    public static final String GL4   = &quot;GL4&quot;.intern();
    
    which is identified by semver as incompatible,
    due to Bug 1059 (no more inlining of interned string references).

+++

Further &apos;.intern()&apos; removals must happen for version 2.3.0 
to not break backward binary compatibility.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4186</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-03 17:14:00 +0200</bug_when>
    <thetext>(In reply to comment #4)
&gt; 
&gt; Further &apos;.intern()&apos; removals must happen for version 2.3.0 
&gt; to not break backward binary compatibility.

Moved from 2.2.1 -&gt; 2.3.0:
  &lt;https://jogamp.org/wiki/index.php/SW_Tracking_Report_Objectives_for_the_release_2.3.0&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4550</commentid>
    <comment_count>6</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2015-01-27 15:06:18 +0100</bug_when>
    <thetext>if we have no activity here anymore, I may close this bug &apos;in a while&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6510</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2020-01-05 01:12:07 +0100</bug_when>
    <thetext>keep it open as a reminder</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>