JDK-6178365 : Compile Error - Abstract error in LoginModule
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-10-13
  • Updated: 2010-04-05
  • Resolved: 2004-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b10Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Code that used to compile just fine when using the JAAS API no longer compile giving me the following error:

DummyLoginModule.java:17: abstract method initialize(javax.security.auth.Subject,javax.security.auth.callback.CallbackHandler,java.util.Map<java.lang.String,?>,java.util.Map<java.lang.String,?>) in javax.security.auth.spi.LoginModule cannot be accessed directly
        super.initialize(subject, callbackHandler, sharedState, options);


DummyLoginModule is a subclass of an AbstractLoginModule I created with one abstract method called doAuthenticate. The DummyLoginModule class overrides initialize() method of the parent class and also makes a call to super.initialize() which is where the compile error happens.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The following two classes compiled just fine under 1.4.2_05..but no longer compile under 1.5.. just try to compile the two classes under 1.5


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting the code to compile without any modifications between 1.4 and 1.5.. or am I wrong?
ACTUAL -
When trying to compile from the command line I get the following error:
Where %JAVA_HOME% is pointing to my JDK1.5.0

C:\Documents and Settings\tmulle\IdeaProjects\AbstractTest\src>"%JAVA_HOME%\bin\javac.exe" *.java -Xlint -d ..\classes
DummyLoginModule.java:17: abstract method initialize(javax.security.auth.Subject,javax.security.auth.callback.CallbackHandler,java.util.Map<java.lang.String,?>,java.util.Map<java.lang.String,?>) in ja
vax.security.auth.spi.LoginModule cannot be accessed directly
        super.initialize(subject, callbackHandler, sharedState, options);
             ^
DummyLoginModule.java:17: warning: [unchecked] unchecked conversion
found   : java.util.Map
required: java.util.Map<java.lang.String,?>
        super.initialize(subject, callbackHandler, sharedState, options);
                                                   ^
DummyLoginModule.java:17: warning: [unchecked] unchecked conversion
found   : java.util.Map
required: java.util.Map<java.lang.String,?>
        super.initialize(subject, callbackHandler, sharedState, options);
                                                                ^
1 error
2 warnings

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.security.auth.spi.LoginModule;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
import javax.security.auth.callback.CallbackHandler;
import java.util.Map;

/**
 * Simple abstract parent class
 */
public abstract class AbstractLoginModule implements LoginModule {

    protected Subject subject;
    protected CallbackHandler callbackHandler;
    protected Map sharedState;
    protected Map options;

    protected abstract boolean doAuthenticate(String user, String password) throws LoginException;

    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
        this.subject = subject;
        this.callbackHandler = callbackHandler;
        this.sharedState = sharedState;
        this.options = options;
    }

    public boolean login() throws LoginException {
        return false;
    }

    public boolean commit() throws LoginException {
        return false;
    }

    public boolean abort() throws LoginException {
        return false;
    }

    public boolean logout() throws LoginException {
        return false;
    }
}


// DummyLoginModule class
import javax.security.auth.login.LoginException;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import java.util.Map;

/**
* Simple subclass of AbstractLoginModule that overrides initialize
* and implements doAuthenticate
 */
public class DummyLoginModule extends AbstractLoginModule {

    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {

        // THIS LINE WILL NOT COMPILE UNDER 1.5
        super.initialize(subject, callbackHandler, sharedState, options);
    }

    protected boolean doAuthenticate(String user, String password) throws LoginException {
        return false;
    }
}




---------- END SOURCE ----------

Release Regression From : 1.4.2_05
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
###@###.### 10/13/04 10:47 GMT

Comments
EVALUATION The class compiles fine with "-source 1.4". This appears to be a javac generics problem, reassigning. ###@###.### 10/13/04 17:46 GMT This is indeed a compiler bug. It seems that 5073079 didn't close this issue completely. ###@###.### 10/14/04 01:21 GMT
13-10-2004

WORK AROUND Compile with "-source 1.4" ###@###.### 10/13/04 17:46 GMT
13-10-2004