RFR: JDK-8027711: Unify wildcarding syntax for CompileCommand and CompileOnly [v4]

Christian Hagedorn chagedorn at openjdk.org
Fri Jun 9 13:28:23 UTC 2023


On Fri, 9 Jun 2023 13:24:20 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:

>> At the moment `CompileCommand` and `CompileOnly` use different syntax for matching methods. 
>> 
>> ### Old CompileOnly format
>> - matching a **method name** with **class name** and **package name**:
>> `-XX:CompileOnly=package/path/Class.method`
>> `-XX:CompileOnly=package/path/Class::method`
>> `-XX:CompileOnly=package.path.Class::method`
>> BUT NOT `-XX:CompileOnly=package.path.Class.method`
>> 
>> - just matching a **single method name**:
>> `-XX:CompileOnly=.hashCode`
>> `-XX:CompileOnly=::hashCode`
>> BUT NOT `-XX:CompileOnly=hashCode`
>> 
>> - Matching **all method names** in a **class name** with **package name**
>> `-XX:CompileOnly=java/lang/String`
>> BUT NOT `-XX:CompileOnly=java/lang/String.`
>> BUT NOT `-XX:CompileOnly=java.lang.String`
>> BUT NOT `-XX:CompileOnly=java.lang.String::` (This is actually a bug) 
>> BUT NOT `-XX:CompileOnly=String`
>> BUT NOT `-XX:CompileOnly=String.`
>> BUT NOT `-XX:CompileOnly=String::`
>> 
>> - Matching **all method names** in a **class name** with **NO package name**
>> `-XX:CompileOnly=String`
>> BUT NOT `-XX:CompileOnly=String.`
>> BUT NOT `-XX:CompileOnly=String::`
>> 
>> - There is a bug when `CompileOnly` ends with `::` where the `CompileOnly` is just ignored
>> e.g. `-XX:CompileOnly=String::` compiles as many methods as when omitting the `-XX:CompileOnly=` command
>> 
>> ### CompileCommand=compileonly format
>> `CompileCommand` allows two different forms for paths: 
>> - `package/path/Class.method`
>> - `package.path.Class::method`
>> 
>> In contrary to `CompileOnly` `CompileCommand` supports wildcard matching using `*`. `*` can appear at the beginning and/or end of a `package.path.Class` and `method` name. 
>> 
>>  Valid forms: 
>> `-XX:CompileCommand=compileonly,*.lang.*::*shCo*`
>> `-XX:CompileCommand=compileonly,*/lang/*.*shCo*` 
>> `-XX:CompileCommand=compileonly,java.lang.String::*`
>> `-XX:CompileCommand=compileonly,*::hashCode`
>> `-XX:CompileCommand=compileonly,*ng.String::hashC*`
>> `-XX:CompileCommand=compileonly,*String::hash*`
>> 
>>  Invalid forms (Error: Embedded * not allowed):
>>  `-XX:CompileCommand=compileonly,java.*.String::has*Code`
>> 
>> ### Use CompileCommand syntax for CompileOnly
>> At the moment, in some cases it is not possible to just take pattern used with `CompileOnly` and plug it into compile command file. Syntax used by CompileOnly is also not very intuitive. 
>> 
>> `CompileOnly` is convenient because it's shorter to write and takes lists of patterns, whereas `CompileCommand` only takes one pattern per command. 
>> 
>> W...
>
> Tobias Holenstein has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
> 
>  - Merge branch 'master' into JDK-8027711
>  - Update TestStableUShort.java
>  - Update TestStableUByte.java
>  - Update TestStableShort.java
>  - Update TestStableObject.java
>  - Update TestStableLong.java
>  - Update TestStableInt.java
>  - Update TestStableFloat.java
>  - Update TestStableDouble.java
>  - Update TestStableChar.java
>  - ... and 8 more: https://git.openjdk.org/jdk/compare/c0527561...c9ae4991

Marked as reviewed by chagedorn (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/13802#pullrequestreview-1472058579


More information about the core-libs-dev mailing list