Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Java 11 #117

Closed
mathisdt opened this issue Oct 16, 2018 · 8 comments
Closed

support Java 11 #117

mathisdt opened this issue Oct 16, 2018 · 8 comments

Comments

@mathisdt
Copy link

mathisdt commented Oct 16, 2018

When running ArchUnit 0.9.1 with Java 11, I get the following output:

...
INFO  c.t.archunit.core.importer.JavaClassProcessor      {} Analysing class 'Anonymized$1'
WARN  c.t.archunit.core.importer.ClassFileProcessor      {} Couldn't import class from file:///home/me/workspaces/Default/myproject/target/test-classes/Anonymized$1.class
java.lang.UnsupportedOperationException: null
	at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassVisitor.visitNestHostExperimental(ClassVisitor.java:158)
	at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.accept(ClassReader.java:541)
	at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
	at com.tngtech.archunit.core.importer.ClassFileProcessor.process(ClassFileProcessor.java:55)
	at com.tngtech.archunit.core.importer.ClassFileImporter.importLocations(ClassFileImporter.java:317)
	at com.tngtech.archunit.core.importer.ClassFileImporter.importPackages(ClassFileImporter.java:196)
	at com.tngtech.archunit.core.importer.ClassFileImporter.importPackages(ClassFileImporter.java:207)
	at MyTest.<init>(MyTest.java:21)
	...

When running under Java 8, all works fine. It seems that the repackaged version of ASM doesn't support Java 11 - could you please update it or convert it to a real dependency (so I can manage the version)?

@hankem
Copy link
Member

hankem commented Oct 17, 2018

As @codecholeric is off for vacation, he might not be able to respond as quickly as usual... ;)

It seems to me that ASM is the most relevant implementation detail of ArchUnit, so it might be difficult to have its version managed externally.

On the jdk-11 branch of my fork, I've tried to update the ASM version to 7.0-beta just released two and a half weeks ago. I'm, however, not yet sure whether there isn't actually more work needed, as 126 of ArchUnit's tests still fail for me with (Open)JDK 11, and I haven't found the time yet to look into the issues in detail.

@hankem
Copy link
Member

hankem commented Oct 17, 2018

Okay, 'looking at the issues in detail' boiled down to reading the error message

java.lang.UnsupportedOperationException: This feature requires ASM7
	at org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:236) ~[asm-7.0-beta.jar:7.0-beta]
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:651) ~[asm-7.0-beta.jar:7.0-beta]
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:391) ~[asm-7.0-beta.jar:7.0-beta]
	at com.tngtech.archunit.core.importer.ClassFileProcessor.process(ClassFileProcessor.java:55) [classes/:?]

and changing ClassFileProcessor.ASM_API_VERSION from ASM6 to ASM7... ☺

I've just pushed this small change, with which ArchUnit now builds with JDK 11, too.

@mathisdt, unless you want to build that ArchUnit-fork on your own, I'll try to make those artifacts available as version 0.9.2-SNAPHOT.

@mathisdt
Copy link
Author

@hankem That would be great! But perhaps the version number could be a bit more stable, e.g. 0.9.1-JAVA11 ?

@hankem
Copy link
Member

hankem commented Oct 17, 2018

If the changes work out, I'd like to have them reintegrated via a pull request. After that, there will certainly be a stable release at some point.
Regarding the version number: I think the artifact will not be specific to Java 11, just be able to process its class files. (I've just tested them locally in a Java 8 project.)

@hankem
Copy link
Member

hankem commented Oct 23, 2018

I'm sorry for my silence! While I was trying to get access to an "official" repository, I only realized today that I could just as well push the artifacts to github... 😀

But better late than never; you can now get 'com.tngtech.archunit:archunit-junit4:0.9.2-SNAPSHOT' from

    repositories {
        maven { url 'https://raw.github.com/hankem/ArchUnit/artifacts/' }
    }

@hankem
Copy link
Member

hankem commented Oct 23, 2018

(You can actually get all of ArchUnit's 0.9.2-SNAPSHOTartifacts from there. I just copy-&-pasted from my example using archunit-junit4...)

hankem referenced this issue Oct 29, 2018
…t prefix is owned by the JUnit team.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@hankem
Copy link
Member

hankem commented Nov 5, 2018

I don't know whether @mathisdt had the opportunity to test the snapshot artifacts, but as I'm confident from ArchUnit's tests, I'll open the pull request anyways. ;)

@mathisdt
Copy link
Author

mathisdt commented Nov 5, 2018

@hankem, I didn't have the opportunity to test yet, but I'm also confident in ArchUnit's test coverage.
👍 from my side, thanks for your work!

codecholeric added a commit that referenced this issue Nov 8, 2018
Issue: #117
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
codecholeric pushed a commit that referenced this issue Feb 21, 2021
Issue: #117

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
codecholeric pushed a commit that referenced this issue Feb 21, 2021
Issue: #117

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
codecholeric pushed a commit that referenced this issue Feb 21, 2021
Issue: #117

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
codecholeric added a commit that referenced this issue Feb 21, 2021
Issue: #117
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants