@Override for interface methods causes JSP compilation to fail

For some reason, placement @Overridein methods that override interface methods causes JSP to fail to compile in weblogic. Everything definitely works from JDK 1.6.0_14, but this Java 5'ism is still persistent.

Oddly enough, JSP compilation occasionally fails with stacktrace, which points to code that is not necessarily explicitly used by JSP itself.

What's going on here?

+3
source share
5 answers

, @Override , . , , JSP , .

, , , .

JSP- - , vm, . WLS Javelin. , 10, Java Compiler API. , Sun vm Java 1.6. - , .

+3

. Java 6 () @Override . Java 5 . Java 6 @Override , .

, IDE (, NetBeans) , IntelliJ IDEA , . , IDE , IDE.

, , IDE? , ( ) , . IDE .

+3

JSP appc. .

"" , , , , , :

  • -, JSP
  • WebLogic
    • ( )
    • JSPCompilerBackwardsCompatible - , JSP, JSP 2.0

, , , , WebLogic "" .

+1

, WLS Java 5. Oracle/WebLogic. WebLogic Server 10.3, :

Weblogic Server 10.3

, Weblogic Server 10.3 Java 6, , :

Re: WebLogic 10.0 Java 6?
: 9 2009 . 12:26 : user8324142
,
Weblogic 10 JDK6.
Weblogic 10.3 JDK 6.

Java

, JDK

, JDK , :

  • :
    BEA_HOME\WL_HOME\server\bin (Windows)
    BEA_HOME/WL_HOME/server/bin (UNIX)

    BEA_HOME , , WL_HOME wlserver_ < > .

  • , , : setWLSenv.cmd(Windows)
    setWLSenv.sh(UNIX)

  • : java -version

Java:

Java WebLogic

... Java WebLogic Server.... Oracle [startup] script...

, WebLogic , . BEA_HOME\user_projects\domain\domain-name, BEA_HOME - , , - , ....

JAVA_HOME JDK. :
set JAVA_HOME=C:\bea\jdk150_03

...

0

, @Override , , .

, :

public interface MyInterface {
    public void doSomething();
}

The class implementing this interface is below ( MyClassA):

public MyClassA implements MyInterface {
    public void doSomething() {
        System.out.println("This is from MyClassA");
    }
}

Then the class below extends MyClassAand overrides doSomething, and so I would add an annotation @Override.

public MyClassB extends MyClassA implements MyInterface {
    @Override
    public void doSomething() {
        System.out.println("This is from MyClassB");
    }
}

In any case, I would not do this (regardless of whether it is allowed), since it violates the idea of ​​redefining something - you implement, not redefine, the interface:

public MyClassA implements MyInterface {
    @Override
    public void doSomething() {
        System.out.println("This is from MyClassA");
    }
}
-2
source

Source: https://habr.com/ru/post/1761142/


All Articles