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

Fix compile error in builder test harness under javac #3571

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

datho7561
Copy link
Contributor

@datho7561 datho7561 commented Jan 17, 2025

When compiling the builder tests with javac, a "failed to infer type parameters" compiler error is generated.

The following minimal example also produces the compiler error under javac (but not ECJ):

import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class HelloWorld {
	public static void main(String... args) {
		Class[] classes = new Class[] { String.class, List.class };
		List<Class<?>> asdf = new ArrayList<>(Arrays.asList(classes));
	}
}

It's unclear to me which compiler is doing the wrong thing. The code change I made seems to compile under both compilers.

What it does

Fix a compile error in the builder test harness when compiling under javac.

How to test

To reproduce the compiler error (before this change), add the following to the ./org.eclipse.jdt.core.tests.builder/pom.xml "<plugins>" section to configure Tycho to run with javac:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-compiler-plugin</artifactId>
  <configuration>
    <compilerArgs>
      <args></args>
    </compilerArgs>
    <deriveReleaseCompilerArgumentFromTargetLevel>false</deriveReleaseCompilerArgumentFromTargetLevel>
    <compilerId>javac</compilerId>
</plugin>

Then, clean and compile the test bundle (mvn clean compile).

Author checklist

When compiling the builder tests with javac,
a "failed to infer type parameters" compiler error is generated.

The following minimal example also produces the compiler error under
javac:

```java
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class HelloWorld {
	public static void main(String... args) {
		Class[] classes = new Class[] { String.class, List.class };
		List<Class<?>> asdf = new ArrayList<>(Arrays.asList(classes));
	}
}
```

It's unclear to me which compiler is doing the wrong thing,
but the code change I made seems to compiler under both compilers.

Signed-off-by: David Thompson <[email protected]>
@jukzi jukzi added the javac ecj not compatible with javac label Jan 21, 2025
@jukzi
Copy link
Contributor

jukzi commented Jan 21, 2025

Please create and link an issue that there is a javac incompatibility quoting the reproducer, as this PR would be closed but the incompatibility remains.

@datho7561
Copy link
Contributor Author

see #3588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javac ecj not compatible with javac
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants