Compile errors under JDK 1.5? It compiles fine under 1.4.x
Can someone please try to compile these two classes under JDK 1.5.. the same exact code compiles under 1.4.x...
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 login module
*/
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; //To change body of implemented methods use File | Settings | File Templates.
}
public boolean commit() throws LoginException {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
public boolean abort() throws LoginException {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
public boolean logout() throws LoginException {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
}
// DUMMY LOGINMODULE.java
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
*/
public class DummyLoginModule extends AbstractLoginModule {
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
// This line doesn't compile under JDK 1.5 for some reason
super.initialize(subject, callbackHandler, sharedState, options);
}
protected boolean doAuthenticate(String user, String password) throws LoginException {
return false;
}
}
Here is what I get when trying to compile...
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
Thanks...

