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

prevent raw type warnings in tests #2797

Closed

Conversation

hduelme
Copy link
Contributor

@hduelme hduelme commented Aug 6, 2024

What it does

I removed the raw type warnings from the tests. Currently hundreds of times the following is written to console:

----------
1. WARNING in /tmp/comptest/run.1722929041244/verifier/org/eclipse/jdt/core/tests/util/VerifyTests.java (at line 57)
     Class testClass = urlClassLoader.loadClass(className);
     ^^^^^
Class is a raw type. References to generic type Class<T> should be parameterized
----------
2. WARNING in /tmp/comptest/run.1722929041244/verifier/org/eclipse/jdt/core/tests/util/VerifyTests.java (at line 60)
     Method main = testClass.getMethod("main", new Class[] {String[].class});
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class<T> should be parameterized
----------
2 problems (2 warnings)

I added -warn:-raw -warn:-unsafe to the compiler options for compileVerifyTests to prevent this.

One thing I noticed. The code causing this is explicate marked to be compatible with Java 5 language level. If I see it correctly the minimum Java language level is currently 8 for tests. The better solution would be to make the code Java 8 compatible and remove the Java 5 filtering.

How to test

Check the console, no such warnings anymore.

Author checklist

@hduelme
Copy link
Contributor Author

hduelme commented Sep 23, 2024

Fixed in a1a7c18

@hduelme hduelme closed this Sep 23, 2024
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

Successfully merging this pull request may close these issues.

1 participant