[java-highlighting] WIP IDEA-372969 Support JEP 512: Compact Source Files and Instance Main Methods

- update language levels partially
- fix tests

(cherry picked from commit 8d7b599772eda8dfd999bee9f816ec2609be4adb)


(cherry picked from commit 98a507ba78b8fc496651b5800fc3936c9c87b689)

IJ-MR-169535

GitOrigin-RevId: 898e8b4dfc303eb60da6cfff5d756304c461c424
This commit is contained in:
Mikhail Pyltsin
2025-06-20 22:02:29 +02:00
committed by intellij-monorepo-bot
parent 2111b032dc
commit 26de6fc1df
41 changed files with 121 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
class Devk1 {
public void main(String args[]) {
public void main() {
foo();
}

View File

@@ -1,5 +1,5 @@
class Devk1 {
public void main(String args[]) {
public void main() {
foo();
}

View File

@@ -5,7 +5,7 @@ interface Func<TIn, TOut>{
class Main {
public static void main(final String[] args) {
public static void main() {
Func<Integer, String> func = Integer::<error descr="Reference to 'toString' is ambiguous, both 'toString()' and 'toString(int)' match">toString</error>;
System.out.println(func.run(6));
}

View File

@@ -28,7 +28,7 @@ class MyTest {
System.out.println(i);
}
public static void main(String[] args) {
public static void main() {
foo<error descr="Ambiguous method call: both 'MyTest.foo(I1)' and 'MyTest.foo(I2)' match">(Foo::m)</error>;
}
}
@@ -66,7 +66,7 @@ class MyTest1 {
System.out.println(i);
}
public static void main(String[] args) {
public static void main() {
m<error descr="Ambiguous method call: both 'MyTest1.m(I1)' and 'MyTest1.m(I2)' match">(Foo::new)</error>;
}
}
@@ -103,7 +103,7 @@ class MyTest2 {
System.out.println(i);
}
public static void main(String[] args) {
public static void main() {
m<error descr="Ambiguous method call: both 'MyTest2.m(I1)' and 'MyTest2.m(I2)' match">(Foo::new)</error>;
}
}

View File

@@ -1,6 +1,6 @@
class App {
public static void main(String[] args) {
public static void main() {
test(App::getLength);
}

View File

@@ -11,7 +11,7 @@ class Main {
public static void caller(MyCallRet c) {
c.call(3);
}
public static void main(String[] args) {
public static void main() {
caller( (int n) -> { System.out.println(" " + n); } );
}
}

View File

@@ -10,7 +10,7 @@ class Test {
System.out.println(i);
}
public static void main(String[] args) {
public static void main() {
call(()-> null);
}
}

View File

@@ -12,7 +12,7 @@ class Test {
System.out.println(callable);
}
public static void main(String[] args) {
public static void main() {
final Collection<Void> collection = new ArrayList<>();
final Iterable<Void> iterable = collection;
foo(iterable::iterator);

View File

@@ -1,7 +1,7 @@
import java.util.function.Consumer;
class Test {
public static void main(String[] args) {
public static void main() {
Consumer<String> ref = Test::method;
System.out.println(ref);
}

View File

@@ -15,7 +15,7 @@ class BBB {
return null;
}
public static void main(String[] args) {
public static void main() {
f();
}
}

View File

@@ -11,7 +11,7 @@ class TestIntelliJ<T, S extends List<T>> extends SubInterface<T, S> {
return t;
}
public static void main(String... args) {
public static void main() {
TestIntelliJ<String, List<String>> testIntelliJ = new TestIntelliJ<>();
testIntelliJ.test(testIntelliJ);
}

View File

@@ -20,7 +20,7 @@ class Test {
private <T> void process(handler<T> <warning descr="Parameter 'h' is never used">h</warning>) {}
public static void main(String[] args) {
public static void main() {
Test t = new Test();
t.<Message<Result<String>>>process(m -> {
if (m.data.isSuccessful());

View File

@@ -9,7 +9,7 @@ class Test {
System.out.println(objs);
}
public static void main(String[] args) {
public static void main() {
test(String.class, new Runnable[1]);
}
}

View File

@@ -38,7 +38,7 @@ class GenericsError {
}
public static void main(final String[] args) {
public static void main() {
final ListHolder<? extends B> aListHolder = new ListHolder<B>();
final DeletingLooper<? super B> bLooper = new MyDeletingLooper();

View File

@@ -12,7 +12,7 @@ class Main {
System.out.println("Integer... x");
}
public static void main(String[] args) {
public static void main() {
int i = 0;
Integer i2 = 127;
var<error descr="Ambiguous method call: both 'Main.var(int...)' and 'Main.var(Integer...)' match">(i, i2)</error>;

View File

@@ -10,7 +10,7 @@ class Test {
static class IJ implements I, J {}
static class JI implements J, I {}
public static void main(String[] args) {
public static void main() {
new IJ(). f();
new JI(). f();

View File

@@ -4,7 +4,7 @@ class Test {
public void test(int... <warning descr="Parameter 'a' is never used">a</warning>){}
public static void main(String[] args) {
public static void main() {
new Test().test<error descr="Ambiguous method call: both 'Test.test(String...)' and 'Test.test(int...)' match">()</error>;
}
}

View File

@@ -11,7 +11,7 @@ class Foo {
return super.toString();
}
public static void main(String[] args) {
public static void main() {
System.out.println(new Foo().go());
}
}

View File

@@ -34,7 +34,7 @@ class Test {
System.out.println(s);
}
public static void main(String[] args) {
public static void main() {
method(() -> {
voids("-> B");