68 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
8
votes
1
answer
226
views
Is it allowed to select a static class from a parameterized type in Java?
Here's a minimal demo:
public class OuterStaticNestedDemo<E> {
class Outer {
static class StaticNested {}
}
void qualifiedNew(Outer outer) {
new Outer.StaticNested();...
1
vote
0
answers
245
views
Gradle annotation processor with ECJ compiler produces "Unable to get public no-arg constructor" error
I'm trying to compile a gradle project with the ECJ compiler. I have an annotation processor in one of the projects, that the other projects depend on.
When ECJ attempts to run the annotation ...
1
vote
0
answers
55
views
Eclipse compiler and OpenJDK javac behave differently when assigning generic types with wildcards
The following code compiles and runs just fine with Eclipse 2022-12 (4.26.0).
public static void main(String[] args) {
List<List<?>> list = Arrays.asList(Arrays.asList("test")...
0
votes
1
answer
84
views
Does javac generate inaccurate line numbers compared to ecj (for this particular case)?
I use the following class which has this specificity in the equals() method that the return keyword and its expressions are split into several lines (return keyword is on its own line).
package jd....
11
votes
0
answers
957
views
`\u0027\n\u0027` equals `'\''` in Java?
I was playing around with Java Unicode Escapes and accidentally found the following interesting oddities. Here is the code that I wrote:
static void main(String... args) {
/*
* \u0027 ...
2
votes
1
answer
923
views
Java sealed interface permits generic type: gradle complains, eclipse does not
I have three types, A, B, and C, which are defined as follows:
public sealed interface A extends Comparable<A> permits B<?>, C { ...
public non-sealed interface B<T> extends A { ...
0
votes
1
answer
669
views
AspectJ (ajc) with Modules
I am using AspectJ 1.9.7 and I am trying to compile a modular application with ajc. Let's suppose I have a single module called test and the following tree:
.
└── test
├── aspectj
│ ├── Main....
1
vote
1
answer
922
views
Building maven projects with JDT Core compiler
I am a new Maven user. I am aware that the default compiler which Maven uses to build its projects with is Javac. However, I want to use JDT Core compiler in order to build.
I tried adding this plugin ...
5
votes
2
answers
3k
views
JDK 17: Switch statement causes java.lang.VerifyError: Bad type on operand stack
Just tried JDK17 on Eclipse 2021-09 to have it fail with a java.lang.VerifyError, which wasn't very helpful itself. I tracked it down to a switch statement, that gets fed a value pulled out of a Map ...
2
votes
1
answer
219
views
Eclipse Java compiler infers the wrong generic type?
I wonder if this is a bug in ECJ or a valid interpretation of the JLS.
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;
public class ...
3
votes
2
answers
520
views
Optaplanner - drools file cannot be compiled when project is deployed
We developped a SpringBoot project with Java 11 using optaplanner-core and defining rules in a Drools file. We have no issue for running the app in intelliJ with JDK.
We then deployed the app onto ...
0
votes
0
answers
91
views
how to get ast tree from elements in eclipse ecj like JavacTrees.getTree(element) in javac?
I write a custom annotation Processor, I hope get ast tree in process method in eclipse ecj compiler:
private JavacProcessingEnvironment env;
private BaseProcessingEnvImpl eclipseEnv;
@Override
...
Guo's user avatar
- 1,823
0
votes
1
answer
254
views
How get the output from one maven plugin into another?
I currently run the Eclipse Java compiler (ECJ) plugin in Maven in order to scan my code for errors and warnings. I want to design a plugin for Maven that is able to take in all the errors and ...
0
votes
0
answers
97
views
Error - cannot infer type-variable(s) K,V - OpenJDK 1.8 vs ECJ 1.8 difference with lambdas?
I have following code:
Type a;
List<Pair<Consumer<LocalDate>, LocalDate>> list = new LinkedList<>();
a.getListB().stream().forEach((TypeB b) -> {
list.add(new Pair<&...
4
votes
0
answers
178
views
Sealing interface with generics in eclipse
The following is legal (i.e. I can compile it) and works in Java 15 with preview features enabled (in eclipse 2020-09)
public sealed interface Quantity<T> permits QuantityImpl { }
public record ...