diff options
author | Alexander Kurtakov | 2017-04-19 08:38:10 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-04-19 08:38:10 +0000 |
commit | 27c703748b287f26e7a0919c7342e93011fc45ca (patch) | |
tree | ad3872554360d9e3f406028591b79ca3e03bdb04 | |
parent | fb014dc8ea660391da6f98b5fae88c38bfd91f5a (diff) | |
download | org.eclipse.dltk.tcl-27c703748b287f26e7a0919c7342e93011fc45ca.tar.gz org.eclipse.dltk.tcl-27c703748b287f26e7a0919c7342e93011fc45ca.tar.xz org.eclipse.dltk.tcl-27c703748b287f26e7a0919c7342e93011fc45ca.zip |
tcl.validators: Fix warnings.
Enable more warnings and fix them. Also enable save actions to automate.
Change-Id: I7a0d39573abd0085bc54a72ae7b051fc8f871129
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
8 files changed, 262 insertions, 115 deletions
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.core.prefs b/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.core.prefs index 583575b9..ea192657 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.core.prefs +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.core.prefs @@ -1,14 +1,111 @@ -#Fri Oct 29 14:46:53 CEST 2010 eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.5 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.ui.prefs b/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.ui.prefs index 4a407e02..2be769c9 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.ui.prefs +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,61 @@ -#Fri Oct 29 14:46:53 CEST 2010 eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile formatter_settings_version=11 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedProcCheck.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedProcCheck.java index 01786ab5..fd2aa39a 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedProcCheck.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedProcCheck.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Andrei Sobolev) @@ -15,6 +15,7 @@ package org.eclipse.dltk.tcl.internal.validators.checks; import java.util.List; import java.util.Map; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.dltk.core.IScriptProject; import org.eclipse.dltk.core.builder.ISourceLineTracker; import org.eclipse.dltk.core.mixin.IMixinElement; @@ -37,7 +38,8 @@ public class UndefinedProcCheck implements ITclCheck { public void checkCommands(List<TclCommand> commands, final ITclErrorReporter reporter, Map<String, String> options, - final IScriptProject project, ISourceLineTracker sourceLineTracker) { + final IScriptProject project, + ISourceLineTracker sourceLineTracker) { TclParserUtils.traverse(commands, new TclVisitor() { @Override public boolean visit(TclCommand command) { @@ -54,9 +56,10 @@ public class UndefinedProcCheck implements ITclCheck { return true; } IMixinElement[] elements = TclMixinModel.getInstance() - .getMixin(project).find( - qName.replaceAll("::", - IMixinRequestor.MIXIN_NAME_SEPARATOR)); + .getMixin(project) + .find(qName.replaceAll("::", + IMixinRequestor.MIXIN_NAME_SEPARATOR), + new NullProgressMonitor()); String realName = ((StringArgument) name).getValue(); if (realName.indexOf("::") != -1) { realName = realName @@ -74,8 +77,8 @@ public class UndefinedProcCheck implements ITclCheck { } if (!found) { reporter.report(ICheckKinds.CHECK_UNDEFINED_PROC, - "Call to undefined proc:" + realName, null, name - .getStart(), name.getEnd(), + "Call to undefined proc:" + realName, null, + name.getStart(), name.getEnd(), ITclErrorReporter.WARNING); } return true; diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedVariableCheck.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedVariableCheck.java index 47944e3a..2f983a60 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedVariableCheck.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UndefinedVariableCheck.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Andrei Sobolev) @@ -15,6 +15,7 @@ package org.eclipse.dltk.tcl.internal.validators.checks; import java.util.List; import java.util.Map; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.dltk.core.IScriptProject; import org.eclipse.dltk.core.builder.ISourceLineTracker; import org.eclipse.dltk.core.mixin.IMixinElement; @@ -36,15 +37,17 @@ public class UndefinedVariableCheck implements ITclCheck { public void checkCommands(List<TclCommand> commands, final ITclErrorReporter reporter, Map<String, String> options, - final IScriptProject project, ISourceLineTracker sourceLineTracker) { + final IScriptProject project, + ISourceLineTracker sourceLineTracker) { TclParserUtils.traverse(commands, new TclVisitor() { @Override public boolean visit(VariableReference ref) { String name = ref.getName(); IMixinElement[] elements = TclMixinModel.getInstance() - .getMixin(project).find( - name.replaceAll("::", - IMixinRequestor.MIXIN_NAME_SEPARATOR)); + .getMixin(project) + .find(name.replaceAll("::", + IMixinRequestor.MIXIN_NAME_SEPARATOR), + new NullProgressMonitor()); String realName = name; if (realName.indexOf("::") != -1) { realName = realName @@ -62,8 +65,8 @@ public class UndefinedVariableCheck implements ITclCheck { } if (!found) { reporter.report(ICheckKinds.CHECK_UNDEFINED_VARIABLE, - "Use of undefined variable:" + realName, null, ref - .getStart(), ref.getEnd(), + "Use of undefined variable:" + realName, null, + ref.getStart(), ref.getEnd(), ITclErrorReporter.WARNING); } return true; diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UnreachableCodeCheck.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UnreachableCodeCheck.java index 450e7872..f930df74 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UnreachableCodeCheck.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/checks/UnreachableCodeCheck.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Andrei Sobolev) @@ -64,10 +64,10 @@ public class UnreachableCodeCheck implements ITclCheck { } } + @Override public void endVisit(TclCommand tclCommand) { Assert.isNotNull(tclCommand); - if (tclCommand != null - && tclCommand.getDefinition() != null + if (tclCommand != null && tclCommand.getDefinition() != null && "return" .equals(tclCommand.getDefinition().getName())) { error = false; @@ -94,8 +94,8 @@ public class UnreachableCodeCheck implements ITclCheck { traverse(substitution.getCommands(), visitor); int size = substitution.getCommands().size(); if (size != 0) - visitor.endVisit(substitution.getCommands().get( - size - 1)); + visitor.endVisit( + substitution.getCommands().get(size - 1)); } } else if (nde instanceof TclCommand) { TclCommand command = (TclCommand) nde; diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/packages/PackageRequireSourceAnalyser.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/packages/PackageRequireSourceAnalyser.java index df783fba..f80162e6 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/packages/PackageRequireSourceAnalyser.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/internal/validators/packages/PackageRequireSourceAnalyser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -72,8 +72,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.osgi.util.NLS; public class PackageRequireSourceAnalyser implements IBuildParticipant, - IBuildParticipantExtension, IBuildParticipantExtension2, - IBuildParticipantExtension3 { + IBuildParticipantExtension2, IBuildParticipantExtension3 { private final IScriptProject project; private final IInterpreterInstall install; @@ -116,16 +115,16 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, this.project = project; if (!project.exists()) { // thrown exception is caught in the PackageRequireCheckerFactory - throw new IllegalStateException(NLS.bind( - Messages.TclCheckBuilder_interpreterNotFound, - project.getElementName())); + throw new IllegalStateException( + NLS.bind(Messages.TclCheckBuilder_interpreterNotFound, + project.getElementName())); } install = ScriptRuntime.getInterpreterInstall(project); if (install == null) { // thrown exception is caught in the PackageRequireCheckerFactory - throw new IllegalStateException(NLS.bind( - Messages.TclCheckBuilder_interpreterNotFound, - project.getElementName())); + throw new IllegalStateException( + NLS.bind(Messages.TclCheckBuilder_interpreterNotFound, + project.getElementName())); } knownInfos = TclPackagesManager.getPackageInfos(install); variableResolver = new TclVariableResolver( @@ -141,8 +140,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, this.buildType = buildType; this.autoAddPackages = ScriptProjectUtil.isBuilderEnabled(project); List<TclModuleInfo> moduleInfos = new ArrayList<TclModuleInfo>(); - moduleInfos.addAll(TclPackagesManager.getProjectModules(project - .getElementName())); + moduleInfos.addAll( + TclPackagesManager.getProjectModules(project.getElementName())); if (buildType == IBuildParticipantExtension.FULL_BUILD) { // We need to clear all information of builds instead of correction // information. Empty modules will be removed later. @@ -171,8 +170,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, final IBuildpathEntry entry = resolvedBuildpath[i]; if (entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) { final IPath path = entry.getPath(); - final IProject project = workspaceRoot.getProject(path - .lastSegment()); + final IProject project = workspaceRoot + .getProject(path.lastSegment()); if (project.exists()) { List<TclModuleInfo> list = TclPackagesManager .getProjectModules(project.getName()); @@ -184,7 +183,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, private List<TclPackageInfo> knownInfos; - public void buildExternalModule(IBuildContext context) throws CoreException { + public void buildExternalModule(IBuildContext context) + throws CoreException { ISourceModule module = context.getSourceModule(); if (module instanceof TclPackageSourceModule) { /* Do not process modules which are parts of packages */ @@ -234,12 +234,13 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, mInfo.getRequired().addAll(info.getRequired()); mInfo.getSourced().addAll(info.getSourced()); } - modules.add(new ModuleInfo(module.getElementName(), context - .getLineTracker(), context.getProblemReporter(), mInfo, + modules.add(new ModuleInfo(module.getElementName(), + context.getLineTracker(), context.getProblemReporter(), mInfo, modulePath, module)); } - private IPath updateModulePath(IPath modulePath, IEnvironment env, URI uri) { + private IPath updateModulePath(IPath modulePath, IEnvironment env, + URI uri) { URI[] uris = EnvironmentManager.resolve(uri); if (uris.length > 0) { IFileHandle file = env.getFile(uris[0]); @@ -275,7 +276,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, for (UserCorrection userCorrection : corrections) { if (userCorrection.getOriginalValue() .equals(ref.getValue())) { - for (String correction : userCorrection.getUserValue()) { + for (String correction : userCorrection + .getUserValue()) { TclSourceEntry to = TclPackagesFactory.eINSTANCE .createTclSourceEntry(); to.setEnd(ref.getEnd()); @@ -287,8 +289,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, } } if (toCheck.isEmpty()) { - final String resolved = variableResolver.resolve(ref - .getValue()); + final String resolved = variableResolver + .resolve(ref.getValue()); if (resolved == null || resolved.equals(ref.getValue())) { toCheck.add(ref); } else if (resolved != null) { @@ -322,8 +324,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, List<TclSourceEntry> toCheck = new ArrayList<TclSourceEntry>(); for (UserCorrection userCorrection : corrections) { - if (userCorrection.getOriginalValue().equals( - ref.getValue())) { + if (userCorrection.getOriginalValue() + .equals(ref.getValue())) { for (String correction : userCorrection .getUserValue()) { TclSourceEntry to = TclPackagesFactory.eINSTANCE @@ -337,9 +339,10 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, } } if (toCheck.isEmpty()) { - final String resolved = variableResolver.resolve(ref - .getValue()); - if (resolved == null || resolved.equals(ref.getValue())) { + final String resolved = variableResolver + .resolve(ref.getValue()); + if (resolved == null + || resolved.equals(ref.getValue())) { toCheck.add(ref); } else { // resolved != null; @@ -367,8 +370,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, // } // } if (buildType != IBuildParticipantExtension.RECONCILE_BUILD) { - List<TclModuleInfo> mods = packageCollector.getModules().get( - project); + List<TclModuleInfo> mods = packageCollector.getModules() + .get(project); List<TclModuleInfo> result = new ArrayList<TclModuleInfo>(); // Clean modules without required items for (TclModuleInfo tclModuleInfo : mods) { @@ -382,8 +385,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, if (!(tclModuleInfo.getProvided().isEmpty() && tclModuleInfo.getRequired().isEmpty() && tclModuleInfo.getSourced().isEmpty() - && sourceCorrections.isEmpty() && pkgCorrections - .isEmpty())) { + && sourceCorrections.isEmpty() + && pkgCorrections.isEmpty())) { result.add(tclModuleInfo); } } @@ -398,9 +401,7 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, // Do delta refresh try { - ModelManager - .getModelManager() - .getDeltaProcessor() + ModelManager.getModelManager().getDeltaProcessor() .checkExternalChanges(new IModelElement[] { project }, new NullProgressMonitor()); } catch (ModelException e) { @@ -417,7 +418,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, for (TclSourceEntry tclSourceEntry : entries) { values.add(tclSourceEntry.getValue()); } - for (Iterator<UserCorrection> i = corrections.iterator(); i.hasNext();) { + for (Iterator<UserCorrection> i = corrections.iterator(); i + .hasNext();) { final UserCorrection userCorrection = i.next(); if (!values.contains(userCorrection.getOriginalValue())) { i.remove(); @@ -443,7 +445,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, if (!userCorrection.isVariable() && userCorrection.getOriginalValue().equals(value)) { for (String userValue : userCorrection.getUserValue()) { - final IPath sourcedPath = toPath(environment, userValue); + final IPath sourcedPath = toPath(environment, + userValue); if (!sourcedPaths.add(sourcedPath)) { i.remove(); } @@ -466,23 +469,17 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, for (IPath sourcedPath : sourcedPaths) { final IFileHandle file = environment.getFile(sourcedPath); if (!file.exists()) { - reportSourceProblemCorrection( - source, - moduleInfo.reporter, + reportSourceProblemCorrection(source, moduleInfo.reporter, NLS.bind( Messages.PackageRequireSourceAnalyser_CouldNotLocateSourcedFile, - file.toOSString()), value, - moduleInfo.lineTracker); + file.toOSString()), + value, moduleInfo.lineTracker); } else if (file.isDirectory()) { - reportSourceProblemCorrection( - source, - moduleInfo.reporter, + reportSourceProblemCorrection(source, moduleInfo.reporter, Messages.PackageRequireSourceAnalyser_FolderSourcingNotSupported, value, moduleInfo.lineTracker); } else if (!isAutoAddPackages()) { - reportSourceProblem( - source, - moduleInfo.reporter, + reportSourceProblem(source, moduleInfo.reporter, Messages.PackageRequireSourceAnalyser_SourceNotAddedToBuildpath, value, moduleInfo.lineTracker); } else if (autoCorrected @@ -492,12 +489,11 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, } if (sourcedPaths.isEmpty()) { if (!TclPackagesManager.isValidName(value)) { - reportSourceProblemCorrection( - source, - moduleInfo.reporter, + reportSourceProblemCorrection(source, moduleInfo.reporter, NLS.bind( Messages.PackageRequireSourceAnalyser_CouldNotLocateSourcedFileCorrectionRequired, - value), value, moduleInfo.lineTracker); + value), + value, moduleInfo.lineTracker); } } } @@ -505,7 +501,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, private static void setAutoCorrection(EList<UserCorrection> corrections, String src, String value) { - for (Iterator<UserCorrection> i = corrections.iterator(); i.hasNext();) { + for (Iterator<UserCorrection> i = corrections.iterator(); i + .hasNext();) { final UserCorrection userCorrection = i.next(); if (userCorrection.isVariable()) { if (userCorrection.getOriginalValue().equals(src)) { @@ -586,9 +583,9 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, } reporter.reportProblem(new DefaultProblem(message, TclProblems.UNKNOWN_REQUIRED_PACKAGE_CORRECTION, - new String[] { pkgName }, ProblemSeverities.Warning, pkg - .getStart(), pkg.getEnd(), lineTracker - .getLineNumberOfOffset(pkg.getStart()))); + new String[] { pkgName }, ProblemSeverities.Warning, + pkg.getStart(), pkg.getEnd(), + lineTracker.getLineNumberOfOffset(pkg.getStart()))); } private void reportSourceProblem(TclSourceEntry pkg, @@ -607,10 +604,9 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, IProblemReporter reporter, String message, String pkgName, ISourceLineTracker lineTracker) { reporter.reportProblem(new DefaultProblem(message, - TclProblems.UNKNOWN_SOURCE_CORRECTION, - new String[] { pkgName }, ProblemSeverities.Warning, pkg - .getStart(), pkg.getEnd(), lineTracker - .getLineNumberOfOffset(pkg.getStart()))); + TclProblems.UNKNOWN_SOURCE_CORRECTION, new String[] { pkgName }, + ProblemSeverities.Warning, pkg.getStart(), pkg.getEnd(), + lineTracker.getLineNumberOfOffset(pkg.getStart()))); } private void checkPackage(TclSourceEntry pkg, IProblemReporter reporter, @@ -618,8 +614,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, Set<String> names, Set<String> autoNames) { final String packageName = pkg.getValue(); - List<TclModuleInfo> collected = packageCollector.getModules().get( - project); + List<TclModuleInfo> collected = packageCollector.getModules() + .get(project); if (collected != null) { if (isProvided(packageName, collected)) { return; @@ -633,16 +629,14 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, if (!isKnownPackage(packageName)) { if (!TclPackagesManager.isValidName(packageName)) { - reportPackageProblemCorrection( - pkg, - reporter, - NLS.bind( - Messages.PackageRequireSourceAnalyser_CouldNotDetectPackageCorrectionRequired, - packageName), packageName, lineTracker); + reportPackageProblemCorrection(pkg, reporter, NLS.bind( + Messages.PackageRequireSourceAnalyser_CouldNotDetectPackageCorrectionRequired, + packageName), packageName, lineTracker); return; } else { - reportPackageProblem(pkg, reporter, NLS.bind( - Messages.TclCheckBuilder_unknownPackage, packageName), + reportPackageProblem(pkg, reporter, + NLS.bind(Messages.TclCheckBuilder_unknownPackage, + packageName), packageName, lineTracker); } return; @@ -654,9 +648,11 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, // enabled. if (!names.contains(packageName) && !autoNames.contains(packageName)) { - reportPackageProblem(pkg, reporter, NLS.bind( - Messages.TclCheckBuilder_unresolvedDependencies, - packageName), packageName, lineTracker); + reportPackageProblem(pkg, reporter, + NLS.bind( + Messages.TclCheckBuilder_unresolvedDependencies, + packageName), + packageName, lineTracker); } return; } @@ -683,8 +679,8 @@ public class PackageRequireSourceAnalyser implements IBuildParticipant, EList<TclSourceEntry> provided = tclModuleInfo.getProvided(); for (TclSourceEntry tclSourceEntry : provided) { if (tclSourceEntry.getValue().equals(packageName)) { - IModelElement element = DLTKCore.create(tclModuleInfo - .getHandle()); + IModelElement element = DLTKCore + .create(tclModuleInfo.getHandle()); // Check for file existence if (element != null && element.exists()) { return true; // Found provided package diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclChecksValidatorType.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclChecksValidatorType.java index a289a181..edbd314c 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclChecksValidatorType.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclChecksValidatorType.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Andrei Sobolev) @@ -20,6 +20,7 @@ import org.eclipse.dltk.tcl.internal.validators.TclCheckBuildParticipant; public class TclChecksValidatorType extends AbstractBuildParticipantType { + @Override public IBuildParticipant createBuildParticipant(IScriptProject project) throws CoreException { return new TclCheckBuildParticipant(project); diff --git a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclValidatorsCore.java b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclValidatorsCore.java index dabc5beb..d069039b 100644 --- a/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclValidatorsCore.java +++ b/tcl/plugins/org.eclipse.dltk.tcl.validators/src/org/eclipse/dltk/tcl/validators/TclValidatorsCore.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 xored software, Inc. + * Copyright (c) 2008, 2017 xored software, Inc. and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * xored software, Inc. - initial API and Implementation (Andrei Sobolev) @@ -35,24 +35,14 @@ public class TclValidatorsCore extends Plugin { public TclValidatorsCore() { } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; TclPlugin.REPORT_PARSER_PROBLEMS = false; } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); @@ -60,7 +50,7 @@ public class TclValidatorsCore extends Plugin { /** * Returns the shared instance - * + * * @return the shared instance */ public static TclValidatorsCore getDefault() { @@ -71,8 +61,8 @@ public class TclValidatorsCore extends Plugin { * @param e */ public static void error(Throwable e) { - getDefault().getLog().log( - new Status(IStatus.ERROR, PLUGIN_ID, e.toString(), e)); + getDefault().getLog() + .log(new Status(IStatus.ERROR, PLUGIN_ID, e.toString(), e)); } } |