2,494 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
8
votes
1
answer
211
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();...
Advice
0
votes
3
replies
108
views
Explicit class reference during static initialization not allowed. Why?
Note. I hope "why" questions do fall into the "other" category.
This compiles.
class MyClass {
private static final String STRING;
static {
STRING = "abc&...
3
votes
1
answer
114
views
Java code runs in IDE, but fails to compile in terminal [closed]
I'm curious to know why I get this error when compiling my java file from the terminal.
I expect the program to compile into an executable file, yet instead I get errors about my packages not existing....
1
vote
0
answers
76
views
Why doesn't the Java compiler in IntelliJ IDEA complain about filename case mismatches? [duplicate]
I'm learning Java and experimenting with compiling source files. I understand that Java is case-sensitive, and that the filename must match the public class name exactly — including the case.
public ...
2
votes
1
answer
150
views
javac 21 Xlint not showing warnings for missing serial version ID on an anonymous class unlike Eclipse
I have a Maven parent POM that configures the Maven Compiler Plugin like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</...
1
vote
1
answer
160
views
Does java compiler (javac) require JVM to compile the java code? [duplicate]
So I got to know that javac compiler is written in Java. And JVM converts the bytecode (compiled Java code) to machine code for execution.
Two questions:
If javac is written in Java, does compiling ...
7
votes
1
answer
345
views
Why does using instanceof pattern matching on a record field with a switch expression in the same method cause a java.lang.VerifyError?
I found this minimal set of code which seems to break any Java version I can find. (Also reproducible in https://www.onlinegdb.com/online_java_compiler with Java 23.0.2+7-58). The example is not meant ...
0
votes
1
answer
215
views
ktor sample app not building due to java compiler not found
I am new to ktor and am following the ktor tutorial (https://ktor.io/docs/server-create-a-new-project.html) and am unable to build the sample app (5th step of unpacking, https://ktor.io/docs/server-...
1
vote
1
answer
697
views
How to specify an ASM and lombok version to Maven on Java 24 project?
I am working on a project expecting Maven to resolve version issues and dependencies but keeps crashing on compile phase.
First I had the known "unknown reference" for jdk 24:
[JAVAC][com....
-2
votes
1
answer
152
views
Reflection API and JVM and JIT [closed]
The compiler compiles the source code into bytecode that is then converted into machine code by the JVM or the JIT compiler. If the JIT compiler converts the bytecode to machine code then there is no ...
1
vote
0
answers
124
views
Simple Maven project with maven.compiler.release not working
I have the following simple POM, with only one .java file in src/main/java:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0&...
3
votes
1
answer
128
views
How Java internally processes `String` concatenation operator `+` in a chain?
Here is the code:
import java.util.Random;
public class StringConcatCompilerOptimization
{
private static long compute() {
var random = new Random();
var l = random.nextLong();
...
0
votes
0
answers
62
views
Java compiler (via Apache Ant) not detecting jars in library folder (generated by Apache Ivy)
I've very recently begun working with Ant as my primary buildtool, and have been enjoying it so much that I really would rather stick with it for a while. The only frustrating issue I've run into is ...
2
votes
0
answers
323
views
Error: Cannot query the value of this provider because it has no value available when running react-native run-android
I am encountering an issue while trying to run my React Native application on Android using the command:
react-native run-android
The build fails with the following error:
Could not determine the ...
1
vote
2
answers
285
views
Unable to import com.sun.tools.javac.util.Pair
I'm new to java and currently using open-jdk and javac 21 and Eclipse IDE.
I'm trying to import om.sun.tools.javac.util.Pair and getting the error -
"The type com.sun.tools.javac.util.Pair is not ...