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

JavaCompilerSpec.findsDocErrors failing for Windows Java 17/21 #1451

Closed
Friendseeker opened this issue Oct 10, 2024 · 3 comments · Fixed by #1455
Closed

JavaCompilerSpec.findsDocErrors failing for Windows Java 17/21 #1451

Friendseeker opened this issue Oct 10, 2024 · 3 comments · Fixed by #1455
Assignees

Comments

@Friendseeker
Copy link
Member

c.c. #1440 (comment)

The issue is JavaErrorParser.parseProblems(in, logger) failing to parse javadoc output. Here's the problematic in for reference

Loading source file D:\Repos\zinc\internal\zinc-compile-core\target\jvm-2.13\test-classes\sbt\internal\inc\javac\test1.java...
Constructing Javadoc information...
D:\Repos\zinc\internal\zinc-compile-core\target\jvm-2.13\test-classes\sbt\internal\inc\javac\test1.java:14: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
D:\Repos\zinc\internal\zinc-compile-core\target\jvm-2.13\test-classes\sbt\internal\inc\javac\test1.java:15: error: cannot find symbol
    public NotFound foo() { return 5; }
           ^
  symbol:   class NotFound
  location: class Test
2 errors

With the log, it should be possible to debug the issue on other platforms.

@Friendseeker Friendseeker changed the title JavaCompilerSpec failing for Windows Java 17 JavaCompilerSpec.findsDocErrors failing for Windows Java 17 Oct 10, 2024
@Friendseeker Friendseeker self-assigned this Oct 10, 2024
@Friendseeker Friendseeker reopened this Oct 17, 2024
@Friendseeker
Copy link
Member Author

Friendseeker commented Oct 17, 2024

There's a deeper bug. "Loading source file, Constructing Javadoc information"... etc should be part of standard output and JavaErrorParser takes information from standard error, so it does not need to parse such non-problems...

I now suspect it is actually a JDK bug, or maybe Scala is not properly forwarding the information to standard error somehow.

Or maybe it is good old concurrency issue...

The fix to explicitly match for "Loading source file, Constructing Javadoc information" did not actually fix the root cause. It also has i18n issue.

@Friendseeker Friendseeker changed the title JavaCompilerSpec.findsDocErrors failing for Windows Java 17 JavaCompilerSpec.findsDocErrors failing for Windows Java 17/21 Oct 17, 2024
@Friendseeker
Copy link
Member Author

Friendseeker commented Oct 17, 2024

Might have to do with https://bugs.openjdk.org/browse/JDK-8280181?jql=affectedVersion%20%3D%20%2217%22%20AND%20text%20~%20%22javac%20standard%20error%22

Still, it is weird that it happens with the very specific configuration with Windows Java 17 & 21.

@Friendseeker
Copy link
Member Author

Did more testing on Windows CMD. Indeed "Loading source file, Constructing Javadoc information" are emitted by javadoc to standard error for whatever reason...

Guess I shall conclude the investigation here. Nothing much we can do about the windows specific deviation.

D:\Repos\zinc\internal\zinc-compile-core\src\test\resources\sbt\internal\inc\javac>javadoc test1.java >nul
Loading source file test1.java...
Constructing Javadoc information...
test1.java:14: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
test1.java:15: error: cannot find symbol
    public NotFound foo() { return 5; }
           ^
  symbol:   class NotFound
  location: class Test
2 errors

D:\Repos\zinc\internal\zinc-compile-core\src\test\resources\sbt\internal\inc\javac>javadoc test1.java good.java bad.java test2.java hasstaticfinal.java  1>nul
Loading source file test1.java...
Loading source file good.java...
Loading source file bad.java...
Loading source file test2.java...
Loading source file hasstaticfinal.java...
Constructing Javadoc information...
test1.java:14: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
bad.java:13: error: modifier private not allowed here
private interface Foo {
        ^
test1.java:15: error: cannot find symbol
    public NotFound foo() { return 5; }
           ^
  symbol:   class NotFound
  location: class Test
hasstaticfinal.java:14: error: cannot find symbol
    public static final TYPE HELLO = VALUE;
                        ^
  symbol:   class TYPE
  location: class hasstaticfinal
4 errors

D:\Repos\zinc\internal\zinc-compile-core\src\test\resources\sbt\internal\inc\javac>javac  test1.java good.java bad.java test2.java hasstaticfinal.java  1>nul
test1.java:14: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
bad.java:13: error: modifier private not allowed here
private interface Foo {
        ^
test1.java:15: error: cannot find symbol
    public NotFound foo() { return 5; }
           ^
  symbol:   class NotFound
  location: class Test
hasstaticfinal.java:14: error: cannot find symbol
    public static final TYPE HELLO = VALUE;
                        ^
  symbol:   class TYPE
  location: class hasstaticfinal
test1.java:25: error: not an enclosing class: C.D
        D.this.toString();
         ^
hasstaticfinal.java:14: error: cannot find symbol
    public static final TYPE HELLO = VALUE;
                                     ^
  symbol:   variable VALUE
  location: class hasstaticfinal
Note: test1.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors

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 a pull request may close this issue.

1 participant