RFR: 7903132: Replace casts with type test pattern

Ethan McCue duke at openjdk.java.net
Fri Mar 25 16:22:36 UTC 2022


On Fri, 25 Mar 2022 15:35:43 GMT, Ethan McCue <duke at openjdk.java.net> wrote:

>> src/main/java/org/openjdk/jextract/impl/ClassSourceBuilder.java line 59:
>> 
>>> 57:     ClassSourceBuilder(JavaSourceBuilder enclosing, Kind kind, String name) {
>>> 58:         this.enclosing = enclosing;
>>> 59:         this.align = (enclosing instanceof ClassSourceBuilder enclosing) ? enclosing.align : 0;
>> 
>> This is resulting in a compilation error:
>> 
>> jextract\src\main\java\org\openjdk\jextract\impl\ClassSourceBuilder.java:59: error: variable enclosing is already defined in constructor ClassSourceBuilder(JavaSourceBuilder,Kind,String)
>>         this.align = (enclosing instanceof ClassSourceBuilder enclosing) ? enclosing.align : 0;
>> 
>> Please build and test the patch locally on your machine as well, if you haven't done so already. (This should be done before suggesting changes).
>
> So yes, 100% on me. But in my defense I am getting a particularly obtuse error before compilation and there isn't exactly someone to ask without pretense.
> 
> 
> $ /usr/bin/clang --version
> Apple clang version 13.1.6 (clang-1316.0.21.2)
> Target: arm64-apple-darwin21.3.0
> Thread model: posix
> InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> 
> ---------------------
> 
> $ sh ./gradlew -Pjdk18_home=/Users/emccue/Library/Java/JavaVirtualMachines/openjdk-18/Contents/Home  clean verify
> 
> FAILURE: Build failed with an exception.
> 
> * Where:
> Build file '/Users/emccue/Development/jextract/build.gradle' line: 13
> 
> * What went wrong:
> A problem occurred evaluating root project 'jextract'.
>> Could not get unknown property 'libclang_home' for root project 'jextract' of type org.gradle.api.Project.
> 
> * Try:
>> Run with --stacktrace option to get the stack trace.
>> Run with --info or --debug option to get more log output.
>> Run with --scan to get full insights.
> 
> * Get more help at https://help.gradle.org
> 
> BUILD FAILED in 297ms
> 
> ---------------------
> 
> $ sh ./gradlew -Pjdk18_home=/Users/emccue/Library/Java/JavaVirtualMachines/openjdk-18/Contents/Home -Plibclang_home=/usr/bin/clang clean verify
> 
> FAILURE: Build failed with an exception.
> 
> * Where:
> Build file '/Users/emccue/Development/jextract/build.gradle' line: 14
> 
> * What went wrong:
> A problem occurred evaluating root project 'jextract'.
>> Cannot invoke method getAt() on null object
> 
> * Try:
>> Run with --stacktrace option to get the stack trace.
>> Run with --info or --debug option to get more log output.
>> Run with --scan to get full insights.
> 
> * Get more help at https://help.gradle.org
> 
> BUILD FAILED in 287ms
> 
> ---------------------
> 
> $ sh ./gradlew -Pjdk18_home=/Users/emccue/Library/Java/JavaVirtualMachines/openjdk-18/Contents/Home -Plibclang_home=/usr/bin/ clean verify
> 
> FAILURE: Build failed with an exception.
> 
> * Where:
> Build file '/Users/emccue/Development/jextract/build.gradle' line: 14
> 
> * What went wrong:
> A problem occurred evaluating root project 'jextract'.
>> Cannot invoke method getAt() on null object
> 
> * Try:
>> Run with --stacktrace option to get the stack trace.
>> Run with --info or --debug option to get more log output.
>> Run with --scan to get full insights.
> 
> * Get more help at https://help.gradle.org
> 
> BUILD FAILED in 290ms

(I was counting on some CI/CD to be triggered on PR, which i suppose either isn't the case or isn't the case unless i get past the issue number check)

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

PR: https://git.openjdk.java.net/jextract/pull/5


More information about the jextract-dev mailing list