0

I'm getting this exception thrown in my java code when trying to run the file.

Exception in thread "main" java.lang.ExceptionInInitializerError
at DemoLexer.<clinit>(GenLexer.java:309)
at LexerDemo.main(GenLexer.java:325)
Caused by: java.lang.RuntimeException: Uncompilable source code - MH_Lexer.VarAcceptor is not abstract and does not override abstract method dead(int) in GenAcceptor
Lexer>  at GenAcceptor.<clinit>(GenLexer.java:14)
... 2 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

The issue is that my VarAcceptor class has a clearly defined and implemented dead(int) method and that file itself doesn't show any errors, which it otherwise does when you don't implement the methods properly so I don't know how to solve this, seeing that the error makes no sense to me with the method in question being implemented correctly. I have also added the @Override annotation to the method.

  static class VarAcceptor extends GenAcceptor implements DFA {

    @Override
    boolean dead(int state) {
        return 0;
    }
}

Interface GenAcceptor:

abstract class GenAcceptor {

    abstract String lexClass() ;
    abstract int numberOfStates() ;
    abstract int nextState (int state, char input) ;
    abstract boolean accepting (int state) ;
    abstract boolean dead (int state) ;
}
Gemtastic
  • 6,253
  • 6
  • 34
  • 53
Alk
  • 5,215
  • 8
  • 47
  • 116

2 Answers2

0

You can't return 0 from a boolean method

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87
  • That was just an example, I'm not returning 0...please remove this if you can as the problem was solved in the comments – Alk Oct 25 '15 at 02:39
0

java.lang.RuntimeException: Uncompilable source code - what can cause this?

The error is described in this link. It is a netbeans issue which requires turning off a setting in project properties.

Community
  • 1
  • 1
Alk
  • 5,215
  • 8
  • 47
  • 116