Package org.aspectj.org.eclipse.jdt.core.compiler

Examples of org.aspectj.org.eclipse.jdt.core.compiler.InvalidInputException


          consumeToken();
          break;

        case TerminalTokens.TokenNameDOT :
          if ((iToken & 1) == 0) { // dots must be even tokens
            throw new InvalidInputException();
          }
          consumeToken();
          break;

        case TerminalTokens.TokenNamevoid :
        case TerminalTokens.TokenNameboolean :
        case TerminalTokens.TokenNamebyte :
        case TerminalTokens.TokenNamechar :
        case TerminalTokens.TokenNamedouble :
        case TerminalTokens.TokenNamefloat :
        case TerminalTokens.TokenNameint :
        case TerminalTokens.TokenNamelong :
        case TerminalTokens.TokenNameshort :
          if (iToken > 0) {
            throw new InvalidInputException();
          }
          pushIdentifier(true, false);
          primitiveToken = token;
          consumeToken();
          break nextToken;

        default :
          if (iToken == 0) {
            if (this.identifierPtr>=0) {
              this.lastIdentifierEndPosition = (int) this.identifierPositionStack[this.identifierPtr];
            }
            return null;
          }
          if ((iToken & 1) == 0) { // cannot leave on a dot
            switch (parserKind) {
              case COMPLETION_PARSER:
                if (this.identifierPtr>=0) {
                  this.lastIdentifierEndPosition = (int) this.identifierPositionStack[this.identifierPtr];
                }
                return syntaxRecoverQualifiedName(primitiveToken);
              case DOM_PARSER:
                if (this.currentTokenType != -1) {
                  // Reset position: we want to rescan last token
                  this.index = this.tokenPreviousPosition;
                  this.scanner.currentPosition = this.tokenPreviousPosition;
                  this.currentTokenType = -1;
                }
                // fall through default case to raise exception
              default:
                throw new InvalidInputException();
            }
          }
          break nextToken;
      }
    }
View Full Code Here


      }
      if (argNamePos >= 0) argEnd = (int) argNamePos;
      return new JavadocArgumentExpression(name, argTypeRef.sourceStart, argEnd, argTypeRef);
    }
    catch (ClassCastException ex) {
      throw new InvalidInputException();
    }
  }
View Full Code Here

      field.tagSourceEnd = this.tagSourceEnd;
      field.tagValue = this.tagValue;
      return field;
    }
    catch (ClassCastException ex) {
      throw new InvalidInputException();
    }
  }
View Full Code Here

              }
              return null;
            }
          }
        } else {
          throw new InvalidInputException();
        }
      }
      // Create node
      if (arguments == null) {
        if (isConstructor) {
          JavadocAllocationExpression allocation = new JavadocAllocationExpression(this.identifierPositionStack[length-1]);
          allocation.type = typeRef;
          allocation.tagValue = this.tagValue;
          allocation.sourceEnd = this.scanner.getCurrentTokenEndPosition();
          if (length == 1) {
            allocation.qualification = new char[][] { this.identifierStack[0] };
          } else {
            System.arraycopy(this.identifierStack, 0, allocation.qualification = new char[length][], 0, length);
            allocation.sourceStart = (int) (this.identifierPositionStack[0] >>> 32);
          }
          allocation.memberStart = this.memberStart;
          return allocation;
        } else {
          JavadocMessageSend msg = new JavadocMessageSend(this.identifierStack[length-1], this.identifierPositionStack[length-1]);
          msg.receiver = typeRef;
          msg.tagValue = this.tagValue;
          msg.sourceEnd = this.scanner.getCurrentTokenEndPosition();
          return msg;
        }
      } else {
        JavadocArgumentExpression[] expressions = new JavadocArgumentExpression[arguments.size()];
        arguments.toArray(expressions);
        if (isConstructor) {
          JavadocAllocationExpression allocation = new JavadocAllocationExpression(this.identifierPositionStack[length-1]);
          allocation.arguments = expressions;
          allocation.type = typeRef;
          allocation.tagValue = this.tagValue;
          allocation.sourceEnd = this.scanner.getCurrentTokenEndPosition();
          if (length == 1) {
            allocation.qualification = new char[][] { this.identifierStack[0] };
          } else {
            System.arraycopy(this.identifierStack, 0, allocation.qualification = new char[length][], 0, length);
            allocation.sourceStart = (int) (this.identifierPositionStack[0] >>> 32);
          }
          allocation.memberStart = this.memberStart;
          return allocation;
        } else {
          JavadocMessageSend msg = new JavadocMessageSend(this.identifierStack[length-1], this.identifierPositionStack[length-1], expressions);
          msg.receiver = typeRef;
          msg.tagValue = this.tagValue;
          msg.sourceEnd = this.scanner.getCurrentTokenEndPosition();
          return msg;
        }
      }
    }
    catch (ClassCastException ex) {
      throw new InvalidInputException();
    }
  }
View Full Code Here

public static boolean isDigit(char c) throws InvalidInputException {
  if(c < ScannerHelper.MAX_OBVIOUS) {
    return (ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_DIGIT) != 0;
  }
  if (Character.isDigit(c)) {
    throw new InvalidInputException(Scanner.INVALID_DIGIT);
  }
  return false;
}
View Full Code Here

    destPath = NONE; // keep == comparison valid
  }
  if (rejectDestinationPathOnJars && destPath != null &&
      (currentClasspathName.endsWith(".jar") || //$NON-NLS-1$
        currentClasspathName.endsWith(".zip"))) { //$NON-NLS-1$
    throw new InvalidInputException(
      this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$
            currentClasspathName));
  }
  FileSystem.Classpath currentClasspath = FileSystem.getClasspath(
      currentClasspathName,
View Full Code Here

    if (start >= 0 && end >= 0 && start < end){
      taskTags = token.substring(start+1, end).trim();
      taskTags = taskTags.replace('|',',');
    }
    if (taskTags.length() == 0){
      throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$
    }
    this.options.put(
      CompilerOptions.OPTION_TaskTags,
      isEnabling ? taskTags : Util.EMPTY_STRING);
  } else if (token.equals("assertIdentifier")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportAssertIdentifier,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("enumIdentifier")) { //$NON-NLS-1$
    this.options.put(
        CompilerOptions.OPTION_ReportEnumIdentifier,
        isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("finally")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportFinallyBlockNotCompletingNormally,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("unusedThrown")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("unqualifiedField") //$NON-NLS-1$
      || token.equals("unqualified-field-access")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportUnqualifiedFieldAccess,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("typeHiding")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportTypeParameterHiding,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("varargsCast")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportVarargsArgumentNeedCast,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("null")) { //$NON-NLS-1$
    if (isEnabling) {
      this.options.put(CompilerOptions.OPTION_ReportNullReference,
          CompilerOptions.WARNING);
      this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference,
          CompilerOptions.WARNING);
      this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck,
          CompilerOptions.WARNING);
    } else {
      this.options.put(CompilerOptions.OPTION_ReportNullReference,
          CompilerOptions.IGNORE);
      this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference,
          CompilerOptions.IGNORE);
      this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck,
          CompilerOptions.IGNORE);
    }
  } else if (token.equals("nullDereference")) { //$NON-NLS-1$
    if (isEnabling) {
      this.options.put(CompilerOptions.OPTION_ReportNullReference,
          CompilerOptions.WARNING);
    } else {
      this.options.put(CompilerOptions.OPTION_ReportNullReference,
          CompilerOptions.IGNORE);
      this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference,
          CompilerOptions.IGNORE);
      this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck,
          CompilerOptions.IGNORE);
    }
  } else if (token.equals("boxing")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportAutoboxing,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("over-ann")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportMissingOverrideAnnotation,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("dep-ann")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportMissingDeprecatedAnnotation,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("intfAnnotation")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportAnnotationSuperInterface,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("enumSwitch") //$NON-NLS-1$
      || token.equals("incomplete-switch")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportIncompleteEnumSwitch,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("hiding")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportHiddenCatchBlock,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportLocalVariableHiding,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportFieldHiding,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportTypeParameterHiding,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("static-access")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportNonStaticAccessToStatic,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportIndirectStaticAccess,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("unused")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedLocal,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedParameter,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedImport,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedPrivateMember,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
      CompilerOptions.OPTION_ReportUnusedDeclaredThrownException,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
    this.options.put(
        CompilerOptions.OPTION_ReportUnusedLabel,
        isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("paramAssign")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportParameterAssignment,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("discouraged")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportDiscouragedReference,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("forbidden")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportForbiddenReference,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("fallthrough")) { //$NON-NLS-1$
    this.options.put(
      CompilerOptions.OPTION_ReportFallthroughCase,
      isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else if (token.equals("super")) { //$NON-NLS-1$
    this.options.put(
        CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation,
        isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
  } else {
    throw new InvalidInputException(this.bind("configure.invalidWarning", token)); //$NON-NLS-1$
  }
}
View Full Code Here

              buffer.append(line).append(" "); //$NON-NLS-1$
            }
          }
          newArgs = tokenize(buffer.toString());
        } catch(IOException e) {
          throw new InvalidInputException(
            this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$
        }
      }
      if (newArgs != null) {
        int newCommandLineArgsLength = newCommandLineArgs.length;
        int newArgsLength = newArgs.length;
        System.arraycopy(newCommandLineArgs, 0, (newCommandLineArgs = new String[newCommandLineArgsLength + newArgsLength - 1]), 0, index);
        System.arraycopy(newArgs, 0, newCommandLineArgs, index, newArgsLength);
        index += newArgsLength;
      } else {
        newCommandLineArgs[index++] = arg;
      }
    }
    index = -1;
  } else {
    newCommandLineArgs = argv;
    for (int i = 0; i < argCount; i++) {
      newCommandLineArgs[i] = newCommandLineArgs[i].trim();
    }
  }
  argCount = newCommandLineArgs.length;
  this.expandedCommandLine = newCommandLineArgs;
  while (++index < argCount) {

    if (customEncoding != null) {
      throw new InvalidInputException(
        this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$
    }

    currentArg = newCommandLineArgs[index];

    switch(mode) {
      case DEFAULT :
        if (currentArg.startsWith("[")) { //$NON-NLS-1$
          throw new InvalidInputException(
            this.bind("configure.unexpectedBracket", //$NON-NLS-1$
                  currentArg));
        }

        if (currentArg.endsWith("]")) { //$NON-NLS-1$
          // look for encoding specification
          int encodingStart = currentArg.indexOf('[') + 1;
          if (encodingStart <= 1) {
            throw new InvalidInputException(
                this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$
          }
          int encodingEnd = currentArg.length() - 1;
          if (encodingStart >= 1) {
            if (encodingStart < encodingEnd) {
              customEncoding = currentArg.substring(encodingStart, encodingEnd);
              try { // ensure encoding is supported
                new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding);
              } catch (UnsupportedEncodingException e) {
                throw new InvalidInputException(
                  this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$
              }
            }
            currentArg = currentArg.substring(0, encodingStart - 1);
          }
        }

        if (currentArg.endsWith(SuffixConstants.SUFFIX_STRING_java)) {
          if (this.filenames == null) {
            this.filenames = new String[argCount - index];
            this.encodings = new String[argCount - index];
            this.destinationPaths = new String[argCount - index];
          } else if (filesCount == this.filenames.length) {
            int length = this.filenames.length;
            System.arraycopy(
              this.filenames,
              0,
              (this.filenames = new String[length + argCount - index]),
              0,
              length);
            System.arraycopy(
              this.encodings,
              0,
              (this.encodings = new String[length + argCount - index]),
              0,
              length);
            System.arraycopy(
              this.destinationPaths,
              0,
              (this.destinationPaths = new String[length + argCount - index]),
              0,
              length);
          }
          this.filenames[filesCount] = currentArg;
          this.encodings[filesCount++] = customEncoding;
          // destination path cannot be specified upon an individual file
          customEncoding = null;
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-log")) { //$NON-NLS-1$
          if (this.log != null)
            throw new InvalidInputException(
              this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$
          mode = INSIDE_LOG;
          continue;
        }
        if (currentArg.equals("-repeat")) { //$NON-NLS-1$
          if (this.repetitions > 0)
            throw new InvalidInputException(
              this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$
          mode = INSIDE_REPETITION;
          continue;
        }
        if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$
          if (this.maxProblems > 0)
            throw new InvalidInputException(
              this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$
          mode = INSIDE_MAX_PROBLEMS;
          continue;
        }
        if (currentArg.equals("-source")) { //$NON-NLS-1$
          mode = INSIDE_SOURCE;
          continue;
        }
        if (currentArg.equals("-encoding")) { //$NON-NLS-1$
          mode = INSIDE_DEFAULT_ENCODING;
          continue;
        }
        if (currentArg.equals("-1.3")) { //$NON-NLS-1$
          if (didSpecifyCompliance) {
            throw new InvalidInputException(
              this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$
          }
          didSpecifyCompliance = true;
          this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-1.4")) { //$NON-NLS-1$
          if (didSpecifyCompliance) {
            throw new InvalidInputException(
              this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
          }
          didSpecifyCompliance = true;
          this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          if (didSpecifyCompliance) {
            throw new InvalidInputException(
              this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
          }
          didSpecifyCompliance = true;
          this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          if (didSpecifyCompliance) {
            throw new InvalidInputException(
              this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
          }
          didSpecifyCompliance = true;
          this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          if (didSpecifyCompliance) {
            throw new InvalidInputException(
              this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
          }
          didSpecifyCompliance = true;
          this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-d")) { //$NON-NLS-1$
          if (this.destinationPath != null) {
            StringBuffer errorMessage = new StringBuffer();
            errorMessage.append(currentArg);
            if ((index + 1) < argCount) {
              errorMessage.append(' ');
              errorMessage.append(newCommandLineArgs[index + 1]);
            }
            throw new InvalidInputException(
              this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$
          }
          mode = INSIDE_DESTINATION_PATH;
          continue;
        }
        if (currentArg.equals("-classpath") //$NON-NLS-1$
          || currentArg.equals("-cp")) { //$NON-NLS-1$
          mode = INSIDE_CLASSPATH_start;
          continue;
        }
        if (currentArg.equals("-bootclasspath")) {//$NON-NLS-1$
          if (bootclasspaths.size() > 0) {
            StringBuffer errorMessage = new StringBuffer();
            errorMessage.append(currentArg);
            if ((index + 1) < argCount) {
              errorMessage.append(' ');
              errorMessage.append(newCommandLineArgs[index + 1]);
            }
            throw new InvalidInputException(
              this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$
          }
          mode = INSIDE_BOOTCLASSPATH_start;
          continue;
        }
        if (currentArg.equals("-sourcepath")) {//$NON-NLS-1$
          if (sourcepathClasspathArg != null) {
            StringBuffer errorMessage = new StringBuffer();
            errorMessage.append(currentArg);
            if ((index + 1) < argCount) {
              errorMessage.append(' ');
              errorMessage.append(newCommandLineArgs[index + 1]);
            }
            throw new InvalidInputException(
              this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$
          }
          mode = INSIDE_SOURCE_PATH_start;
          continue;
        }
        if (currentArg.equals("-extdirs")) {//$NON-NLS-1$
          if (extdirsClasspaths != null) {
            StringBuffer errorMessage = new StringBuffer();
            errorMessage.append(currentArg);
            if ((index + 1) < argCount) {
              errorMessage.append(' ');
              errorMessage.append(newCommandLineArgs[index + 1]);
            }
            throw new InvalidInputException(
              this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$
          }
          mode = INSIDE_EXT_DIRS;
          continue;
        }
        if (currentArg.equals("-endorseddirs")) { //$NON-NLS-1$
          if (endorsedDirClasspaths != null) {
            StringBuffer errorMessage = new StringBuffer();
            errorMessage.append(currentArg);
            if ((index + 1) < argCount) {
              errorMessage.append(' ');
              errorMessage.append(newCommandLineArgs[index + 1]);
            }
            throw new InvalidInputException(
              this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$
          }
          mode = INSIDE_ENDORSED_DIRS;
          continue;
        }
        if (currentArg.equals("-progress")) { //$NON-NLS-1$
          mode = DEFAULT;
          this.showProgress = true;
          continue;
        }
        if (currentArg.equals("-proceedOnError")) { //$NON-NLS-1$
          mode = DEFAULT;
          this.proceedOnError = true;
          continue;
        }
        if (currentArg.equals("-time")) { //$NON-NLS-1$
          mode = DEFAULT;
          this.timing = true;
          continue;
        }
        if (currentArg.equals("-version") //$NON-NLS-1$
            || currentArg.equals("-v")) { //$NON-NLS-1$
          this.logger.logVersion(true);
          this.proceed = false;
          return;
        }
        if (currentArg.equals("-showversion")) { //$NON-NLS-1$
          printVersionRequired = true;
          mode = DEFAULT;
          continue;
        }
        if ("-deprecation".equals(currentArg)) { //$NON-NLS-1$
          didSpecifyDeprecation = true;
          this.options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-help") || currentArg.equals("-?")) { //$NON-NLS-1$ //$NON-NLS-2$
          printUsageRequired = true;
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-help:warn") || //$NON-NLS-1$
            currentArg.equals("-?:warn")) { //$NON-NLS-1$
          printUsageRequired = true;
          usageSection = "misc.usage.warn"; //$NON-NLS-1$
          continue;
        }
        if (currentArg.equals("-noExit")) { //$NON-NLS-1$
          this.systemExitWhenFinished = false;
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-verbose")) { //$NON-NLS-1$
          this.verbose = true;
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-referenceInfo")) { //$NON-NLS-1$
          this.produceRefInfo = true;
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
            mode = DEFAULT;
          this.options.put(
              CompilerOptions.OPTION_InlineJsr,
              CompilerOptions.ENABLED);
            continue;
        }
        if (currentArg.startsWith("-g")) { //$NON-NLS-1$
          mode = DEFAULT;
          String debugOption = currentArg;
          int length = currentArg.length();
          if (length == 2) {
            this.options.put(
              CompilerOptions.OPTION_LocalVariableAttribute,
              CompilerOptions.GENERATE);
            this.options.put(
              CompilerOptions.OPTION_LineNumberAttribute,
              CompilerOptions.GENERATE);
            this.options.put(
              CompilerOptions.OPTION_SourceFileAttribute,
              CompilerOptions.GENERATE);
            continue;
          }
          if (length > 3) {
            this.options.put(
              CompilerOptions.OPTION_LocalVariableAttribute,
              CompilerOptions.DO_NOT_GENERATE);
            this.options.put(
              CompilerOptions.OPTION_LineNumberAttribute,
              CompilerOptions.DO_NOT_GENERATE);
            this.options.put(
              CompilerOptions.OPTION_SourceFileAttribute,
              CompilerOptions.DO_NOT_GENERATE);
            if (length == 7 && debugOption.equals("-g:" + NONE)) //$NON-NLS-1$
              continue;
            StringTokenizer tokenizer =
              new StringTokenizer(debugOption.substring(3, debugOption.length()), ","); //$NON-NLS-1$
            while (tokenizer.hasMoreTokens()) {
              String token = tokenizer.nextToken();
              if (token.equals("vars")) { //$NON-NLS-1$
                this.options.put(
                  CompilerOptions.OPTION_LocalVariableAttribute,
                  CompilerOptions.GENERATE);
              } else if (token.equals("lines")) { //$NON-NLS-1$
                this.options.put(
                  CompilerOptions.OPTION_LineNumberAttribute,
                  CompilerOptions.GENERATE);
              } else if (token.equals("source")) { //$NON-NLS-1$
                this.options.put(
                  CompilerOptions.OPTION_SourceFileAttribute,
                  CompilerOptions.GENERATE);
              } else {
                throw new InvalidInputException(
                  this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
              }
            }
            continue;
          }
          throw new InvalidInputException(
            this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$
        }
        if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$
          disableWarnings();
          mode = DEFAULT;
          continue;
        }
        if (currentArg.startsWith("-warn")) { //$NON-NLS-1$
          mode = DEFAULT;
          String warningOption = currentArg;
          int length = currentArg.length();
          if (length == 10 && warningOption.equals("-warn:" + NONE)) { //$NON-NLS-1$
            disableWarnings();
            continue;
          }
          if (length <= 6) {
            throw new InvalidInputException(
              this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$
          }
          int warnTokenStart;
          boolean isEnabling;
          switch (warningOption.charAt(6)) {
            case '+' :
              warnTokenStart = 7;
              isEnabling = true;
              break;
            case '-' :
              warnTokenStart = 7;
              isEnabling = false; // mentionned warnings are disabled
              break;
            default:
              warnTokenStart = 6;
              // clear default warning level
              // but allow multiple warning option on the command line
              if (!didSpecifyWarnings) disableWarnings();
              isEnabling = true;
          }

          StringTokenizer tokenizer =
            new StringTokenizer(warningOption.substring(warnTokenStart, warningOption.length()), ","); //$NON-NLS-1$
          int tokenCounter = 0;

          if (didSpecifyDeprecation) {  // deprecation could have also been set through -deprecation option
            this.options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING);
          }

          while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            tokenCounter++;
            handleWarningToken(token, isEnabling, useEnableJavadoc);
          }
          if (tokenCounter == 0)
            throw new InvalidInputException(
              this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$
          didSpecifyWarnings = true;
          continue;
        }
        if (currentArg.equals("-target")) { //$NON-NLS-1$
          mode = INSIDE_TARGET;
          continue;
        }
        if (currentArg.equals("-preserveAllLocals")) { //$NON-NLS-1$
          this.options.put(
            CompilerOptions.OPTION_PreserveUnusedLocal,
            CompilerOptions.PRESERVE);
            mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-enableJavadoc")) {//$NON-NLS-1$
            mode = DEFAULT;
          this.options.put(
            CompilerOptions.OPTION_DocCommentSupport,
            CompilerOptions.ENABLED);
          useEnableJavadoc = true;
          continue;
        }
        if (currentArg.equals("-Xemacs")) { //$NON-NLS-1$
          mode = DEFAULT;
          this.logger.setEmacs();
          continue;
        }
        // annotation processing
        if (currentArg.startsWith("-A")) { //$NON-NLS-1$
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-processorpath")) { //$NON-NLS-1$
          mode = INSIDE_PROCESSOR_PATH_start;
          continue;
        }
        if (currentArg.equals("-processor")) { //$NON-NLS-1$
          mode = INSIDE_PROCESSOR_start;
          continue;
        }
        if (currentArg.equals("-proc:only")) { //$NON-NLS-1$
          this.options.put(
            CompilerOptions.OPTION_GenerateClassFiles,
            CompilerOptions.DISABLED);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-proc:none")) { //$NON-NLS-1$
          didSpecifyDisabledAnnotationProcessing = true;
          this.options.put(
            CompilerOptions.OPTION_Process_Annotations,
            CompilerOptions.DISABLED);
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-s")) { //$NON-NLS-1$
          mode = INSIDE_S_start;
          continue;
        }
        if (currentArg.equals("-XprintProcessorInfo") //$NON-NLS-1$
            || currentArg.equals("-XprintRounds")) { //$NON-NLS-1$
          mode = DEFAULT;
          continue;
        }
        // tolerated javac options - quietly filtered out
        if (currentArg.startsWith("-X")) { //$NON-NLS-1$
          mode = DEFAULT;
          continue;
        }
        if (currentArg.startsWith("-J")) { //$NON-NLS-1$
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-O")) { //$NON-NLS-1$
          mode = DEFAULT;
          continue;
        }
        if (currentArg.equals("-classNames")) { //$NON-NLS-1$
          mode = INSIDE_CLASS_NAMES;
          continue;
        }
        break;
      case INSIDE_TARGET :
        if (this.didSpecifyTarget) {
          throw new InvalidInputException(
            this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$
        }
        this.didSpecifyTarget = true;
        if (currentArg.equals("1.1")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
        } else if (currentArg.equals("1.2")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
        } else if (currentArg.equals("1.3")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
        } else if (currentArg.equals("1.4")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
        } else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
        } else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
        } else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7);
        } else if (currentArg.equals("jsr14")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_JSR14);
        } else {
          throw new InvalidInputException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
        }
        mode = DEFAULT;
        continue;
      case INSIDE_LOG :
        this.log = currentArg;
        mode = DEFAULT;
        continue;
      case INSIDE_REPETITION :
        try {
          this.repetitions = Integer.parseInt(currentArg);
          if (this.repetitions <= 0) {
            throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
          }
        } catch (NumberFormatException e) {
          throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$
        }
        mode = DEFAULT;
        continue;
      case INSIDE_MAX_PROBLEMS :
        try {
          this.maxProblems = Integer.parseInt(currentArg);
          if (this.maxProblems <= 0) {
            throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
          }
          this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg);
        } catch (NumberFormatException e) {
          throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$
        }
        mode = DEFAULT;
        continue;
      case INSIDE_SOURCE :
        if (this.didSpecifySource) {
          throw new InvalidInputException(
            this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$
        }
        this.didSpecifySource = true;
        if (currentArg.equals("1.3")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
        } else if (currentArg.equals("1.4")) { //$NON-NLS-1$
          this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
        } else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
        } else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
        } else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
          this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
        } else {
          throw new InvalidInputException(this.bind("configure.source", currentArg)); //$NON-NLS-1$
        }
        mode = DEFAULT;
        continue;
      case INSIDE_DEFAULT_ENCODING :
        if (didSpecifyDefaultEncoding) {
          throw new InvalidInputException(
            this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$
        }
        try { // ensure encoding is supported
          new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
        } catch (UnsupportedEncodingException e) {
          throw new InvalidInputException(
            this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
        }
        this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
        didSpecifyDefaultEncoding = true;
        mode = DEFAULT;
        continue;
      case INSIDE_DESTINATION_PATH :
        this.setDestinationPath(currentArg.equals(NONE) ? NONE : currentArg);
        mode = DEFAULT;
        continue;
      case INSIDE_CLASSPATH_start:
        mode = DEFAULT;
        index += processPaths(newCommandLineArgs, index, currentArg, classpaths);
        continue;
      case INSIDE_BOOTCLASSPATH_start:
        mode = DEFAULT;
        index += processPaths(newCommandLineArgs, index, currentArg, bootclasspaths);
        continue;
      case INSIDE_SOURCE_PATH_start:
        mode = DEFAULT;
        String[] sourcePaths = new String[1];
        index += processPaths(newCommandLineArgs, index, currentArg, sourcePaths);
        sourcepathClasspathArg = sourcePaths[0];
        continue;
      case INSIDE_EXT_DIRS:
        if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
          throw new InvalidInputException(
            this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
              "-extdir")); //$NON-NLS-1$
        }
        StringTokenizer tokenizer = new StringTokenizer(currentArg,  File.pathSeparator, false);
        extdirsClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
        while (tokenizer.hasMoreTokens())
          extdirsClasspaths.add(tokenizer.nextToken());
        mode = DEFAULT;
        continue;
      case INSIDE_ENDORSED_DIRS:
        if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$
          throw new InvalidInputException(
            this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$
              "-endorseddirs")); //$NON-NLS-1$
        }        tokenizer = new StringTokenizer(currentArg,  File.pathSeparator, false);
        endorsedDirClasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH);
        while (tokenizer.hasMoreTokens())
          endorsedDirClasspaths.add(tokenizer.nextToken());
        mode = DEFAULT;
        continue;
      case INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH:
        if (currentArg.endsWith("]")) { //$NON-NLS-1$
          customDestinationPath = currentArg.substring(0,
            currentArg.length() - 1);
        } else {
          throw new InvalidInputException(
            this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$
              "[-d " + currentArg)); //$NON-NLS-1$
        }
        break;
      case INSIDE_PROCESSOR_PATH_start :
        // nothing to do here. This is consumed again by the AnnotationProcessorManager
        mode = DEFAULT;
        continue;
      case INSIDE_PROCESSOR_start :
        // nothing to do here. This is consumed again by the AnnotationProcessorManager
        mode = DEFAULT;
        continue;
      case INSIDE_S_start :
        // nothing to do here. This is consumed again by the AnnotationProcessorManager
        mode = DEFAULT;
        continue;
      case INSIDE_CLASS_NAMES :
        tokenizer = new StringTokenizer(currentArg, ","); //$NON-NLS-1$
        if (this.classNames == null) {
          this.classNames = new String[DEFAULT_SIZE_CLASSPATH];
        }
        while (tokenizer.hasMoreTokens()) {
          if (this.classNames.length == classCount) {
            // resize
            System.arraycopy(
              this.classNames,
              0,
              (this.classNames = new String[classCount * 2]),
              0,
              classCount);
          }
          this.classNames[classCount++] = tokenizer.nextToken();
        }
        mode = DEFAULT;
        continue;
    }

    // default is input directory, if no custom destination path exists
    // AspectJ Extension
    // see pr 60863.  All directories should have been dealt with at the AspectJ layer - if we have left
    // anything to be processed here it is an error.
    throw new InvalidInputException(
          "unrecognized single argument: \""+currentArg+"\"")
        /*
    if (customDestinationPath == null) {
      if (File.separatorChar != '/') {
        currentArg = currentArg.replace('/', File.separatorChar);
View Full Code Here

    defaultEncoding = null;

  for (int i = 0; i < fileCount; i++) {
    char[] charName = this.filenames[i].toCharArray();
    if (knownFileNames.get(charName) != null)
      throw new InvalidInputException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$
    knownFileNames.put(charName, charName);
    File file = new File(this.filenames[i]);
    if (!file.exists())
      throw new InvalidInputException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$
    String encoding = this.encodings[i];
    if (encoding == null)
      encoding = defaultEncoding;
    units[i] = new CompilationUnit(null, this.filenames[i], encoding,
        this.destinationPaths[i]);
View Full Code Here

    if (type != null && type.isValidBinding()) {
      if (type.isBinaryBinding()) {
        referenceBindings[i] = type;
      }
    } else {
      throw new InvalidInputException(
          this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
    }
  }
  return referenceBindings;
}
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.compiler.InvalidInputException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.