JJTreeOptions extends Options { public static void validate() { if (!getVisitor()) { if (getVisitorDataType().length() > 0) { JavaCCErrors.warning("VISITOR_DATA_TYPE option will be ignored since VISITOR is false"); } if (getVisitorReturnType().length() > 0 && !getVisitorReturnType().equals("Object")) { JavaCCErrors.warning("VISITOR_RETURN_TYPE option will be ignored since VISITOR is false"); } if (getVisitorException().length() > 0) { JavaCCErrors.warning("VISITOR_EXCEPTION option will be ignored since VISITOR is false"); } } } protected  JJTreeOptions(); static void init(); static void validate(); static String getJdkVersion(); static boolean getMulti(); static boolean getNodeDefaultVoid(); static boolean getNodeScopeHook(); static String getNodeFactory(); static boolean getNodeUsesParser(); static boolean getBuildNodeFiles(); static boolean getVisitor(); static boolean getTrackTokens(); static String getNodePrefix(); static String getNodeExtends(); static String getNodeClass(); static String getNodePackage(); static String getOutputFile(); static String getVisitorException(); static String getVisitorDataType(); static String getVisitorReturnType(); static File getJJTreeOutputDirectory();  }
@Test public void testValidate() { JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.getWarningCount()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.setCmdLineOption("VISITOR=true"); JJTreeOptions.validate(); assertEquals(0, JavaCCErrors.getWarningCount()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.getWarningCount()); }