RFR: 8303755: Clean up around JavacElements.getAllMembers [v2]

Pavel Rappo prappo at openjdk.org
Tue Mar 7 17:28:03 UTC 2023


On Tue, 7 Mar 2023 15:42:01 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Pavel Rappo has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>> 
>>  - Merge branch 'master' into 8303755
>>    
>>    # Conflicts:
>>    #	src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
>>  - Improve CompoundIterator
>>    
>>    - it could be improved even further, but kept as is to retain its
>>      laziness
>>    - `remove` is deleted as it now is a default Iterator method
>>  - Improve Iterators.createFilterIterator
>>    
>>    Assert that the mechanics relies on iterator being filtered never
>>    to return null.
>>  - Fix typos and improve consistency
>>  - Avoid unnecessary recomputation
>>  - Fix typos and {@inheritDoc} that stands out
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 844:
> 
>> 842:                     return
>> 843:                         thatRank < thisRank ||
>> 844:                         thatRank == thisRank &&
> 
> (minor).  both before and after, the formulation is confusing and could benefit from parentheses or better indentation

Would it be even more clear if we introduced an explicit if-else?

    int thatRank = types.rank(that.type);
    int thisRank = types.rank(this.type);
    if (thatRank < thisRank) {
        return true;
    } else if (thatRank == thisRank) {
        return that.getQualifiedName().compareTo(this.getQualifiedName()) < 0;
    }

-------------

PR: https://git.openjdk.org/jdk/pull/12904


More information about the compiler-dev mailing list