-1
JDK_VERSION이 (기본값 인 1.5로) 설정된 JavaCC 6.0_1을 사용하는 경우 Java docs stating that it exists에도 불구하고 ParseException의 getErrorOffset 메소드를 사용할 수 없습니다.ParseException이 기호를 찾을 수 없습니다.
내가 놓친 것이 있습니까?
최소 예 :
PARSER_BEGIN(B)
class B {
public static void main(String[] args) {
ParseException p = new ParseException("Test", 2);
System.out.println(p.getErrorOffset());
}
}
PARSER_END(B)
TOKEN: {<TRIVIAL: "foo">}
결과 :
$ javacc B.jj
[...]
Parser generated successfully.
$ javac ./*.java
./B.java:5: error: no suitable constructor found for ParseException(String,int)
ParseException p = new ParseException("Test", 2);
^
constructor ParseException.ParseException(Token,int[][],String[]) is not applicable
(actual and formal argument lists differ in length)
constructor ParseException.ParseException() is not applicable
(actual and formal argument lists differ in length)
constructor ParseException.ParseException(String) is not applicable
(actual and formal argument lists differ in length)
./B.java:6: error: cannot find symbol
System.out.println(p.getErrorOffset());
^
symbol: method getErrorOffset()
location: variable p of type ParseException
2 errors
이것은 실제로 질문이 아닙니다. 그것은 당신이 할 수없는 일을 할 수 없다는 진술 일뿐입니다. 메소드를 호출 할 수 없습니다. 왜 그 방법을 사용할 수 없는지 알고 싶다면 그런 방법이 없기 때문입니다. 실제 도움이 필요한 문제가있는 경우 : 예 : "ParseException과 관련된 소스 좌표를 어떻게 찾을 수 있습니까?" 그러면이 질문을 닫고 직접 대답 할 수 없다면 실제로 대답이 필요한 질문을 던지시기 바랍니다. –