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

After compiling and cleaning, bug with comments and after delete commented code text, the bug still exist #8320

Open
AndrewSkuratov opened this issue Mar 12, 2025 · 2 comments
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix needs:triage Requires attention from one of the committers

Comments

@AndrewSkuratov
Copy link

AndrewSkuratov commented Mar 12, 2025

Apache NetBeans version

Apache NetBeans 25

What happened

I wrote this code:

package Lesson24;

public class Test5_2 {
}
interface I1{
    default void abc(){System.out.println("eto metod abc");}
    static void def(){System.out.println("Static method");}
}


interface I2 extends I1{
  default void abc(){System.out.println("abc metod ot I2 интерфейса");}
}



class R implements I1,I2{
    public static void main(String [] args) {
        I1.def();
        R r1 = new R();
        r1.abc();
    }
}

//class Z2 implements I1{
//    public void abc(){System.out.println("eto metod abc");}
//    public static void main(String [] args) {
//        Z2 z = new Z2();
//        z.abc();
//        I1.def(); // к статическим методам интерфейса можно обратиться только через название самого интерфейса.
//        z.ghi();
//    }
//    public void ghi(){System.out.println("eto metod ghi");}
//}

after that i try to comment this lines:

interface I2 extends I1{
  default void abc(){System.out.println("abc metod ot I2 интерфейса");}
}

the code was this:

package Lesson24;

public class Test5_2 {
}
interface I1{
    default void abc(){System.out.println("eto metod abc");}
    static void def(){System.out.println("Static method");}
}


//interface I2 extends I1{
//  default void abc(){System.out.println("abc metod ot I2 интерфейса");}
//}



class R implements I1,I2{
    public static void main(String [] args) {
        I1.def();
        R r1 = new R();
        r1.abc();
    }
}

//class Z2 implements I1{
//    public void abc(){System.out.println("eto metod abc");}
//    public static void main(String [] args) {
//        Z2 z = new Z2();
//        z.abc();
//        I1.def(); // к статическим методам интерфейса можно обратиться только через название самого интерфейса.
//        z.ghi();
//    }
//    public void ghi(){System.out.println("eto metod ghi");}
//}

and then I saw the same output like this important line "abc metod ot I2 интерфейса" which after rebuilding and cleaning project in NetBeans was still appear:

run:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -Dconsole.encoding=UTF-8
Static method
abc metod ot I2 интерфейса
BUILD SUCCESSFUL (total time: 0 seconds)

Language / Project Type / NetBeans Component

Java

How to reproduce

Please try to comment this lines:

//interface I2 extends I1{
//  default void abc(){System.out.println("abc metod ot I2 интерфейса");}
//}

and then compile and run,
than if bug still appear, try to delete this code lines and try to clean and rebuild and run.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11 Pro, 24H2

JDK

23

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Today I try to continue learn the lesson, and... this problem was occurred.

I think, that after first compiling the program code, some compiled files was created, and then, they didn't want to be replaced with new compiled code, or something like that...

Are you willing to submit a pull request?

Yes

@AndrewSkuratov AndrewSkuratov added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Mar 12, 2025
@AndrewSkuratov AndrewSkuratov changed the title After compiling and cleaning bug with comments and after delete commented code text, the bug still exist After compiling and cleaning, bug with comments and after delete commented code text, the bug still exist Mar 12, 2025
@AndrewSkuratov
Copy link
Author

There is another interesting bug:
when I commented this lines:
//interface I2 extends I1{ // default void abc(){System.out.println("abc metod ot I2 интерфейса");} //}
I still leave "as is" this line:
class R implements I1,I2{

and there no error was found, but why?

When I deleted I2 in this line:
class R implements I1,I2{

I think, that the program was corrected showed the output result like this:
run:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -Dconsole.encoding=UTF-8
Static method
eto metod abc
BUILD SUCCESSFUL (total time: 0 seconds)

@AndrewSkuratov
Copy link
Author

I tested the code again, after the comented line of //interface I2 extends I1{ // default void abc(){System.out.println("abc metod ot I2 интерфейса");} //} the byte-code "*.class" file wasn't created - I think that means an error in my program code, but, this error wasn't seen in the debug window and after re-save and run the code, the program runs like in "some cache in PC memory"... and there no changes in output window.

@mbien mbien added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

2 participants