--- /dev/null
+The source code for JPS, JetBrains' Gant-based build system used for
+building IntelliJ, can be found on GitHub:
+
+ http://github.com/shafirov/JPS
fileset(dir: "$home/license")
}
+ ant.copy(file: "$home/LICENSE.txt", todir: "$paths.distAll", preservelastmodified: "true")
+
layoutMac(args, home, paths)
layoutLinux(args, home, paths)
layoutWin(args, home, paths)
replacefilter(token: "@@version@@", value: args.version)
- replacefilter(token: "@@vmoptions@@", value: args.vmoptions)
+ replacefilter(token: "@@vmoptions@@", value: args.vmoptions + " -Xverify:none -XX:+UseCompressedOOPS -XX:+DoEscapeAnalysis")
replacefilter(token: "@@system_selector@@", value: args.system_selector)
replacefilter(token: "@@jdk_req@@", value: args.jdk_req)
}
}
dir("plugins") {
- def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "images"]
+ def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "images", "devkit", "eclipse"]
simplePlugins.each {
layoutPlugin it
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.Task;
import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
final GenerationOptionsImpl[] genOptions = {null};
Runnable runnable = new Runnable() {
public void run() {
- genOptions[0] = new GenerationOptionsImpl(project, dialog.isGenerateSingleFileBuild(), dialog.isFormsCompilationEnabled(), dialog.isBackupFiles(),
- dialog.isForceTargetJdk(), dialog.isRuntimeClasspathInlined(), dialog.isIdeaHomeGenerated(), names);
+ genOptions[0] = new GenerationOptionsImpl(project, dialog.isGenerateSingleFileBuild(), dialog.isFormsCompilationEnabled(),
+ dialog.isBackupFiles(), dialog.isForceTargetJdk(), dialog.isRuntimeClasspathInlined(),
+ dialog.isIdeaHomeGenerated(), names);
}
};
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, "Analyzing project structure...", true, project)) {
Presentation presentation = event.getPresentation();
Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
presentation.setEnabled(project != null);
+ presentation.setVisible(ChunkBuildExtension.hasBuildExtensions());
}
private void generate(final Project project, final GenerationOptions genOptions) {
private static void dropDependencyCache(final CompileContextEx context) {
CompilerUtil.runInContext(context, CompilerBundle.message("progress.saving.caches"), new ThrowableRunnable<RuntimeException>(){
public void run() {
- context.getDependencyCache().dispose();
+ context.getDependencyCache().resetState();
}
});
}
generatedTypes.addAll(compilerManager.getRegisteredOutputTypes(translator));
}
- dropDependencyCache(_context);
-
if (_context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
throw new ExitException(ExitStatus.ERRORS);
}
// perform update only if there were no errors, so it is guaranteed that the file was processd by all neccesary compilers
sink.flushPostponedItems();
}
+ dropDependencyCache(context);
}
return didSomething;
}
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Chunk;
-import com.intellij.util.ThrowableRunnable;
import com.intellij.util.cls.ClsFormatException;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashMap;
// do not update caches if cancelled because there is a chance that they will be incomplete
if (CompilerConfiguration.MAKE_ENABLED) {
- CompilerUtil.runInContext(myCompileContext, CompilerBundle.message("progress.updating.caches"), new ThrowableRunnable<CacheCorruptedException>(){
- public void run() throws CacheCorruptedException {
- ProgressIndicator indicator = myCompileContext.getProgressIndicator();
- myCompileContext.getDependencyCache().update(indicator);
- }
- });
+ ProgressIndicator indicator = myCompileContext.getProgressIndicator();
+ final DependencyCache cache = myCompileContext.getDependencyCache();
+
+ indicator.setText(CompilerBundle.message("progress.updating.caches"));
+ indicator.setText2("");
+
+ cache.update(indicator);
+
+ indicator.setText(CompilerBundle.message("progress.saving.caches"));
+ cache.resetState();
+
+ indicator.setText("");
}
myFilesToRecompile.removeAll(mySuccesfullyCompiledJavaFiles);
return myMarkedInfos.add(qName);
}
- public void dispose() {
+ public void resetState() {
final long start = System.currentTimeMillis();
try {
@NotNull
public ModifiableArtifact addArtifact(@NotNull final String name, @NotNull ArtifactType artifactType) {
- final String outputPath = ArtifactUtil.getDefaultArtifactOutputPath(name, myArtifactManager.getProject());
+ return addArtifact(name, artifactType, artifactType.createRootElement(name));
+ }
- final String artifactName = generateUniqueName(name);
- final CompositePackagingElement<?> rootElement = artifactType.createRootElement(artifactName);
- final ArtifactImpl artifact = new ArtifactImpl(artifactName, artifactType, false, rootElement, outputPath);
+ @NotNull
+ public ModifiableArtifact addArtifact(@NotNull String name, @NotNull ArtifactType artifactType, CompositePackagingElement<?> rootElement) {
+ final String outputPath = ArtifactUtil.getDefaultArtifactOutputPath(name, myArtifactManager.getProject());
+ final ArtifactImpl artifact = new ArtifactImpl(generateUniqueName(name), artifactType, false, rootElement, outputPath);
myOriginalArtifacts.add(artifact);
myArtifact2ModifiableCopy.put(artifact, artifact);
myModifiable2Original.put(artifact, artifact);
import com.intellij.packaging.artifacts.ArtifactType;
import com.intellij.packaging.elements.CompositePackagingElement;
-import com.intellij.packaging.elements.PackagingElement;
-import com.intellij.packaging.elements.PackagingElementResolvingContext;
+import com.intellij.packaging.elements.PackagingElementOutputKind;
import com.intellij.packaging.impl.elements.ArchivePackagingElement;
-import com.intellij.packaging.ui.PackagingSourceItem;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
}
@Override
- public String getDefaultPathFor(@NotNull PackagingSourceItem sourceItem) {
- return "/";
- }
-
- @Override
- public String getDefaultPathFor(@NotNull PackagingElement<?> element, @NotNull PackagingElementResolvingContext context) {
+ public String getDefaultPathFor(@NotNull PackagingElementOutputKind kind) {
return "/";
}
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.util.IconLoader;
import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.PackagingElement;
-import com.intellij.packaging.elements.PackagingElementResolvingContext;
import com.intellij.packaging.elements.CompositePackagingElement;
+import com.intellij.packaging.elements.PackagingElementOutputKind;
import com.intellij.packaging.impl.elements.ArtifactRootElementImpl;
-import com.intellij.packaging.ui.PackagingSourceItem;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
return ARTIFACT_ICON;
}
- public String getDefaultPathFor(@NotNull PackagingSourceItem sourceItem) {
- return "/";
- }
-
@Override
- public String getDefaultPathFor(@NotNull PackagingElement<?> element, @NotNull PackagingElementResolvingContext context) {
+ public String getDefaultPathFor(@NotNull PackagingElementOutputKind kind) {
return "/";
}
package com.intellij.packaging.impl.compiler;
import com.intellij.openapi.compiler.make.PackagingFileFilter;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.elements.IncrementalCompilerInstructionCreator;
import org.jetbrains.annotations.NotNull;
}
public void addDirectoryCopyInstructions(@NotNull VirtualFile directory, @Nullable PackagingFileFilter filter) {
- final Project project = myContext.getCompileContext().getProject();
- final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final VirtualFile[] children = directory.getChildren();
if (children != null) {
+ final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
for (VirtualFile child : children) {
- if (!fileIndex.isIgnored(child)
+ if (!fileTypeManager.isFileIgnored(child.getName())
&& (filter == null || filter.accept(child, myContext.getCompileContext()))) {
if (!child.isDirectory()) {
addFileCopyInstruction(child, child.getName());
package com.intellij.compiler.ant;
import com.intellij.ExtensionPoints;
-import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
public abstract class ChunkBuildExtension {
+ /**
+ * true, if there are build extensions for the modules, the variable is accessed only from AWT thread
+ */
+ private static Boolean myHasExtensions = null;
+
public static final ExtensionPointName<ChunkBuildExtension> EP_NAME = ExtensionPointName.create(ExtensionPoints.ANT_BUILD_GEN);
public abstract boolean haveSelfOutputs(Module[] modules);
return false;
}
+ /**
+ * @return true if there are build extensions registered
+ */
+ public static boolean hasBuildExtensions() {
+ if (myHasExtensions == null) {
+ ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions();
+ myHasExtensions = extensions.length != 0;
+ }
+ return myHasExtensions;
+ }
+
public static String[] getAllTargets(ModuleChunk chunk) {
List<String> allTargets = new ArrayList<String>();
final ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions();
}
}
- public static void generateAllProperties(final PropertyFileGenerator propertyFileGenerator, final Project project,
- final GenerationOptions genOptions) {
+ public static void generateAllProperties(final PropertyFileGenerator propertyFileGenerator,
+ final Project project,
+ final GenerationOptions genOptions) {
ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions();
for (ChunkBuildExtension extension : extensions) {
extension.generateProperties(propertyFileGenerator, project, genOptions);
--- /dev/null
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.packaging.artifacts;
+
+import com.intellij.packaging.elements.CompositePackagingElement;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author nik
+ */
+public abstract class ArtifactTemplate {
+ public abstract String getPresentableName();
+
+ public abstract CompositePackagingElement<?> createRootElement(@NotNull String artifactName);
+}
import com.intellij.openapi.extensions.Extensions;
import com.intellij.packaging.elements.CompositePackagingElement;
import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementOutputKind;
import com.intellij.packaging.elements.PackagingElementResolvingContext;
import com.intellij.packaging.ui.ArtifactValidationManager;
import com.intellij.packaging.ui.PackagingSourceItem;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.util.Collections;
import java.util.List;
/**
public abstract Icon getIcon();
@Nullable
- public abstract String getDefaultPathFor(@NotNull PackagingSourceItem sourceItem);
+ public String getDefaultPathFor(@NotNull PackagingSourceItem sourceItem) {
+ return getDefaultPathFor(sourceItem.getKindOfProducedElements());
+ }
+
+ @Nullable
+ public String getDefaultPathFor(@NotNull PackagingElement<?> element, @NotNull PackagingElementResolvingContext context) {
+ return getDefaultPathFor(element.getFilesKind(context));
+ }
@Nullable
- public abstract String getDefaultPathFor(@NotNull PackagingElement<?> element, @NotNull PackagingElementResolvingContext context);
+ public abstract String getDefaultPathFor(@NotNull PackagingElementOutputKind kind);
public boolean isSuitableItem(@NotNull PackagingSourceItem sourceItem) {
return true;
@NotNull
public abstract CompositePackagingElement<?> createRootElement(@NotNull String artifactName);
+ @NotNull
+ public List<? extends ArtifactTemplate> getNewArtifactTemplates(@NotNull PackagingElementResolvingContext context) {
+ return Collections.emptyList();
+ }
+
public void checkRootElement(@NotNull CompositePackagingElement<?> rootElement, @NotNull Artifact artifact, @NotNull ArtifactValidationManager manager) {
}
*/
package com.intellij.packaging.artifacts;
+import com.intellij.packaging.elements.CompositePackagingElement;
import org.jetbrains.annotations.NotNull;
/**
@NotNull
ModifiableArtifact addArtifact(final @NotNull String name, @NotNull ArtifactType artifactType);
+ @NotNull
+ ModifiableArtifact addArtifact(final @NotNull String name, @NotNull ArtifactType artifactType, CompositePackagingElement<?> rootElement);
+
void removeArtifact(@NotNull Artifact artifact);
@NotNull
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.components.State;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
import com.intellij.packaging.artifacts.*;
+import com.intellij.packaging.elements.CompositePackagingElement;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
final ArtifactType[] types = ArtifactType.getAllTypes();
final AnAction[] actions = new AnAction[types.length];
for (int i = 0; i < types.length; i++) {
- actions[i] = new AddArtifactAction(types[i]);
+ actions[i] = createAddArtifactAction(types[i]);
}
return actions;
}
};
}
- private void addArtifact(@NotNull ArtifactType type) {
+ private AnAction createAddArtifactAction(@NotNull final ArtifactType type) {
+ final List<? extends ArtifactTemplate> templates = type.getNewArtifactTemplates(myPackagingEditorContext);
+ final ArtifactTemplate emptyTemplate = new ArtifactTemplate() {
+ @Override
+ public String getPresentableName() {
+ return "Empty";
+ }
+
+ @Override
+ public CompositePackagingElement<?> createRootElement(@NotNull String artifactName) {
+ return type.createRootElement(artifactName);
+ }
+
+ };
+
+ if (templates.isEmpty()) {
+ return new AddArtifactAction(type, emptyTemplate, type.getPresentableName(), type.getIcon());
+ }
+ final DefaultActionGroup group = new DefaultActionGroup(type.getPresentableName(), true);
+ group.getTemplatePresentation().setIcon(type.getIcon());
+ group.add(new AddArtifactAction(type, emptyTemplate, emptyTemplate.getPresentableName(), null));
+ group.addSeparator();
+ for (ArtifactTemplate template : templates) {
+ group.add(new AddArtifactAction(type, template, template.getPresentableName(), null));
+ }
+ return group;
+ }
+
+ private void addArtifact(@NotNull ArtifactType type, @NotNull ArtifactTemplate artifactTemplate) {
String name = DEFAULT_ARTIFACT_NAME;
int i = 2;
while (myPackagingEditorContext.getArtifactModel().findArtifact(name) != null) {
name = DEFAULT_ARTIFACT_NAME + i;
i++;
}
- final ModifiableArtifact artifact = myPackagingEditorContext.getModifiableArtifactModel().addArtifact(name, type);
+ final ModifiableArtifact artifact = myPackagingEditorContext.getModifiableArtifactModel().addArtifact(name, type, artifactTemplate.createRootElement(name));
selectNodeInTree(findNodeByObject(myRoot, artifact));
}
private class AddArtifactAction extends DumbAwareAction {
private final ArtifactType myType;
+ private final ArtifactTemplate myArtifactTemplate;
- public AddArtifactAction(ArtifactType type) {
- super(ProjectBundle.message("action.text.add.artifact", type.getPresentableName()), null, type.getIcon());
+ public AddArtifactAction(@NotNull ArtifactType type, @NotNull ArtifactTemplate artifactTemplate, final @NotNull String actionText,
+ final Icon icon) {
+ super(actionText, null, icon);
myType = type;
+ myArtifactTemplate = artifactTemplate;
}
@Override
public void actionPerformed(AnActionEvent e) {
- addArtifact(myType);
+ addArtifact(myType, myArtifactTemplate);
}
}
}
updateAndSelect(myTree.getRootPackagingNode(), toSelect);
}
+ public void packInto(@NotNull final List<? extends PackagingSourceItem> items, final String pathToJar) {
+ final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
+ final CompositePackagingElement<?> rootElement = getArtifact().getRootElement();
+ editLayout(new Runnable() {
+ public void run() {
+ final CompositePackagingElement<?> archive = PackagingElementFactory.getInstance().getOrCreateArchive(rootElement, pathToJar);
+ for (PackagingSourceItem item : items) {
+ final List<? extends PackagingElement<?>> elements = item.createElements(myContext);
+ archive.addOrFindChildren(elements);
+ }
+ toSelect.add(archive);
+ }
+ });
+
+ myArtifactsEditor.getSourceItemsTree().rebuildTree();
+ updateAndSelect(myTree.getRootPackagingNode(), toSelect);
+ }
+
public boolean isPropertiesModified() {
final PackagingElementPropertiesPanel panel = mySelectedElementInfo.myCurrentPanel;
return panel != null && panel.isModified();
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorImpl;
import com.intellij.openapi.roots.ui.configuration.artifacts.SimpleDnDAwareTree;
import com.intellij.openapi.roots.ui.configuration.artifacts.SourceItemsDraggingObject;
-import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions.PutSourceItemIntoDefaultLocationAction;
-import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions.PutSourceItemIntoParentAndLinkViaManifestAction;
-import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions.SourceItemFindUsagesAction;
-import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions.SourceItemNavigateAction;
+import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions.*;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.packaging.ui.ArtifactEditorContext;
private ActionGroup createPopupGroup() {
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new PutSourceItemIntoDefaultLocationAction(this, myArtifactsEditor));
+ group.add(new PackAndPutIntoDefaultLocationAction(this, myArtifactsEditor));
group.add(new PutSourceItemIntoParentAndLinkViaManifestAction(this, myArtifactsEditor));
group.add(Separator.getInstance());
--- /dev/null
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.deployment.DeploymentUtil;
+import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorEx;
+import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.SourceItemsTree;
+import com.intellij.packaging.elements.PackagingElementOutputKind;
+import com.intellij.packaging.ui.PackagingSourceItem;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public class PackAndPutIntoDefaultLocationAction extends PutIntoDefaultLocationActionBase {
+ public PackAndPutIntoDefaultLocationAction(SourceItemsTree sourceItemsTree, ArtifactEditorEx artifactEditor) {
+ super(sourceItemsTree, artifactEditor);
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ final String jarName = suggestJarName();
+ final String pathForJars = myArtifactEditor.getArtifact().getArtifactType().getDefaultPathFor(PackagingElementOutputKind.JAR_FILES);
+ final Presentation presentation = e.getPresentation();
+ if (jarName != null && pathForJars != null) {
+ presentation.setText("Pack Into " + DeploymentUtil.appendToPath(pathForJars, jarName + ".jar"));
+ presentation.setVisible(true);
+ }
+ else {
+ presentation.setVisible(false);
+ }
+ }
+
+ @Nullable
+ private String suggestJarName() {
+ final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
+ for (PackagingSourceItem item : items) {
+ if (item.isProvideElements() && item.getKindOfProducedElements().containsDirectoriesWithClasses()) {
+ return item.createPresentation(myArtifactEditor.getContext()).getPresentableName();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ final String pathForJars = myArtifactEditor.getArtifact().getArtifactType().getDefaultPathFor(PackagingElementOutputKind.JAR_FILES);
+ final String jarName = suggestJarName();
+ if (pathForJars != null) {
+ myArtifactEditor.getLayoutTreeComponent().packInto(mySourceItemsTree.getSelectedItems(),
+ DeploymentUtil.appendToPath(pathForJars, jarName + ".jar"));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2000-2009 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorEx;
+import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.SourceItemsTree;
+import com.intellij.packaging.ui.PackagingSourceItem;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author nik
+ */
+public abstract class PutIntoDefaultLocationActionBase extends AnAction {
+ protected final SourceItemsTree mySourceItemsTree;
+ protected final ArtifactEditorEx myArtifactEditor;
+
+ public PutIntoDefaultLocationActionBase(SourceItemsTree sourceItemsTree, ArtifactEditorEx artifactEditor) {
+ mySourceItemsTree = sourceItemsTree;
+ myArtifactEditor = artifactEditor;
+ }
+
+ @Nullable
+ protected String getDefaultPath(PackagingSourceItem item) {
+ return myArtifactEditor.getArtifact().getArtifactType().getDefaultPathFor(item);
+ }
+}
*/
package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions;
-import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorEx;
import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.SourceItemsTree;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.packaging.artifacts.ArtifactType;
import com.intellij.packaging.ui.PackagingSourceItem;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.HashSet;
/**
* @author nik
*/
-public class PutSourceItemIntoDefaultLocationAction extends AnAction {
- private final SourceItemsTree mySourceItemsTree;
- private final ArtifactEditorEx myArtifactEditor;
-
+public class PutSourceItemIntoDefaultLocationAction extends PutIntoDefaultLocationActionBase {
public PutSourceItemIntoDefaultLocationAction(SourceItemsTree sourceItemsTree, ArtifactEditorEx artifactEditor) {
- mySourceItemsTree = sourceItemsTree;
- myArtifactEditor = artifactEditor;
+ super(sourceItemsTree, artifactEditor);
}
@Override
public void update(AnActionEvent e) {
- final ArtifactType type = myArtifactEditor.getArtifact().getArtifactType();
final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
boolean enabled = false;
final Presentation presentation = e.getPresentation();
enabled = true;
Set<String> paths = new HashSet<String>();
for (PackagingSourceItem item : items) {
- final String path = type.getDefaultPathFor(item);
+ final String path = getDefaultPath(item);
if (path == null) {
enabled = false;
break;
*/
package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions;
-import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorEx;
/**
* @author nik
*/
-public class PutSourceItemIntoParentAndLinkViaManifestAction extends AnAction {
- private final SourceItemsTree mySourceItemsTree;
- private final ArtifactEditorEx myArtifactEditor;
-
+public class PutSourceItemIntoParentAndLinkViaManifestAction extends PutIntoDefaultLocationActionBase {
public PutSourceItemIntoParentAndLinkViaManifestAction(SourceItemsTree sourceItemsTree, ArtifactEditorEx artifactEditor) {
- mySourceItemsTree = sourceItemsTree;
- myArtifactEditor = artifactEditor;
+ super(sourceItemsTree, artifactEditor);
}
@Override
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressManager;
import com.intellij.psi.PsiType;
import com.intellij.psi.PsiVariable;
import com.intellij.psi.util.TypeConversionUtil;
SortedIntSet aClass = myEqClasses.get(aClassIndex);
if (aClass != null) {
buf.append("(");
- int[] values = aClass.toNativeArray();
- for (int i = 0; i < values.length; i++) {
+
+ for (int i = 0; i < aClass.size(); i++) {
if (i > 0) buf.append(", ");
- int value = values[i];
+ int value = aClass.get(i);
DfaValue dfaValue = myFactory.getValue(value);
buf.append(dfaValue);
}
}
}
- c1.add(c2.toNativeArray());
- long[] c2Array = c2Pairs.toNativeArray();
- myDistinctClasses.removeAll(c2Array);
- myEqClasses.set(c2Index, null);
- myStateSize--;
+ for (int i = 0; i < c2.size(); i++) {
+ int c = c2.get(i);
+ c1.add(c);
+ }
- for (long l : c2Array) {
- myDistinctClasses.add(createPair(c1Index, low(l) == c2Index ? high(l) : low(l)));
+ for (int i = 0; i < c2Pairs.size(); i++) {
+ long c = c2Pairs.get(i);
+ myDistinctClasses.remove(c);
+ myDistinctClasses.add(createPair(c1Index, low(c) == c2Index ? high(c) : low(c)));
}
+ myEqClasses.set(c2Index, null);
+ myStateSize--;
return true;
}
){
dfaLeft = myFactory.getBoxedFactory().createUnboxed(dfaLeft);
dfaRight = myFactory.getBoxedFactory().createUnboxed(dfaRight);
- if (dfaLeft != null && dfaRight != null) {
- result &= applyRelation(dfaLeft, dfaRight, isNegated);
- }
+ result &= applyRelation(dfaLeft, dfaRight, isNegated);
}
else if (TypeConversionUtil.isPrimitiveAndNotNull(psiVariable.getType())){
dfaLeft = myFactory.getBoxedFactory().createBoxed(dfaLeft);
}
public void flushVariable(@NotNull DfaVariableValue variable) {
- int id = variable.getID();
- for (int varClassIndex = 0; varClassIndex < myEqClasses.size(); varClassIndex++) {
- SortedIntSet varClass = myEqClasses.get(varClassIndex);
+ final int id = variable.getID();
+ int size = myEqClasses.size();
+ int interruptCount = 0;
+ for (int varClassIndex = 0; varClassIndex < size; varClassIndex++) {
+ final SortedIntSet varClass = myEqClasses.get(varClassIndex);
if (varClass == null) continue;
- int[] cls = varClass.toNativeArray();
- for (int i = 0; i < cls.length; i++) {
- int cl = cls[i];
+
+ for (int i = 0; i < varClass.size(); i++) {
+ if ((++interruptCount & 0xf) == 0) {
+ ProgressManager.getInstance().checkCanceled();
+ }
+ int cl = varClass.get(i);
DfaValue value = myFactory.getValue(cl);
- if (value != null && id == value.getID()
- || value instanceof DfaBoxedValue && ((DfaBoxedValue)value).getWrappedValue().getID() == id
- || value instanceof DfaUnboxedValue && ((DfaUnboxedValue)value).getVariable().getID() == id) {
+ if (value != null && id == value.getID() ||
+ value instanceof DfaBoxedValue && ((DfaBoxedValue)value).getWrappedValue().getID() == id ||
+ value instanceof DfaUnboxedValue && ((DfaUnboxedValue)value).getVariable().getID() == id) {
varClass.remove(i);
break;
}
}
+
if (varClass.isEmpty()) {
myEqClasses.set(varClassIndex, null);
myStateSize--;
final String fileTemplateName = template.getName();
String methodName = superSignatures.isEmpty() ? "" : superSignatures.get(0).getName();
String key = returnType.getCanonicalText() + "+" + methodName + "+"+fileTemplateName;
- final Map<String, PsiMethod> cache = getTemplatesCache(project);
+ final Map<String, PsiMethod> cache = getTemplatesCache(aClass);
PsiMethod method = cache.get(key);
if (method == null) {
method = JavaPsiFacade.getInstance(project).getElementFactory().createMethod("x", returnType);
}
}
- private static final Key<Map<String, PsiMethod>> CACHE_IN_PROJECT_KEY = new Key<Map<String, PsiMethod>>("MethodBodyChecker templates cache");
+ private static final Key<Map<String, PsiMethod>> CACHE_KEY = new Key<Map<String, PsiMethod>>("MethodBodyChecker templates cache");
- private static Map<String, PsiMethod> getTemplatesCache(Project project) {
- Map<String, PsiMethod> cache = project.getUserData(CACHE_IN_PROJECT_KEY);
+ private static Map<String, PsiMethod> getTemplatesCache(PsiClass aClass) {
+ Map<String, PsiMethod> cache = aClass.getUserData(CACHE_KEY);
if (cache == null) {
- cache = ((UserDataHolderEx)project).putUserDataIfAbsent(CACHE_IN_PROJECT_KEY, new ConcurrentHashMap<String, PsiMethod>());
+ cache = ((UserDataHolderEx)aClass).putUserDataIfAbsent(CACHE_KEY, new ConcurrentHashMap<String, PsiMethod>());
}
return cache;
}
private static ConcatenationAwareInjector registerForStringVarInitializer(@NotNull Project project,
@NotNull final Language language,
- @NonNls final String varName,
+ @NotNull @NonNls final String varName,
@NonNls final String prefix,
@NonNls final String suffix) {
ConcatenationAwareInjector injector = new ConcatenationAwareInjector() {
if (type1.equals(type2)) return type1;
final int typeRank1 = TypeConversionUtil.getTypeRank(type1);
final int typeRank2 = TypeConversionUtil.getTypeRank(type2);
+
+ // bug in JLS3, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6888770
+ if (type1 instanceof PsiClassType && type2.equals(PsiPrimitiveType.getUnboxedType(type1))) return type2;
+ if (type2 instanceof PsiClassType && type1.equals(PsiPrimitiveType.getUnboxedType(type2))) return type1;
+
if (TypeConversionUtil.isNumericType(typeRank1) && TypeConversionUtil.isNumericType(typeRank2)){
if (typeRank1 == TypeConversionUtil.BYTE_RANK && typeRank2 == TypeConversionUtil.SHORT_RANK) return type2;
if (typeRank1 == TypeConversionUtil.SHORT_RANK && typeRank2 == TypeConversionUtil.BYTE_RANK) return type1;
if (!PsiUtil.isLanguageLevel5OrHigher(this)) {
return null;
}
- if (TypeConversionUtil.isPrimitiveAndNotNull(type1)) type1 = ((PsiPrimitiveType)type1).getBoxedType(this);
- if (type1 == null) return null;
- if (TypeConversionUtil.isPrimitiveAndNotNull(type2)) type2 = ((PsiPrimitiveType)type2).getBoxedType(this);
- if (type2 == null) return null;
+ if (TypeConversionUtil.isPrimitiveAndNotNull(type1)) {
+ type1 = ((PsiPrimitiveType)type1).getBoxedType(this);
+ if (type1 == null) return null;
+ }
+ if (TypeConversionUtil.isPrimitiveAndNotNull(type2)) {
+ type2 = ((PsiPrimitiveType)type2).getBoxedType(this);
+ if (type2 == null) return null;
+ }
return GenericsUtil.getLeastUpperBound(type1, type2, getManager());
}
Collection<PsiMethod> superMethods = new THashSet<PsiMethod>(Arrays.asList(method.findDeepestSuperMethods()));
superMethods.add(method);
Collection<PsiMethod> overrides = new THashSet<PsiMethod>(superMethods);
- //for (PsiMethod superMethod : superMethods) {
- // overrides.addAll(OverridingMethodsSearch.search(superMethod, parent.getScope().toSearchScope(), true).findAll());
- //}
final Set<PsiReference> processed = new THashSet<PsiReference>(); //usages of super method and overridden method can overlap
for (final PsiMethod containingMethod : overrides) {
if (!MethodReferencesSearch.search(containingMethod, parent.getScope().toSearchScope(), false).forEach(new Processor<PsiReference>() {
*/
package com.intellij.slicer.forward;
+import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.MethodReferencesSearch;
import com.intellij.psi.search.searches.OverridingMethodsSearch;
import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.slicer.SliceManager;
import com.intellij.slicer.SliceUsage;
import com.intellij.util.Processor;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collection;
* @author cdr
*/
public class SliceFUtil {
- public static boolean processUsagesFlownFromThe(@NotNull PsiElement element, @NotNull Processor<SliceUsage> processor, @NotNull SliceUsage parent) {
- PsiElement target = getAssignmentTarget(element);
- if (target != null) {
+ public static boolean processUsagesFlownFromThe(@NotNull PsiElement element, @NotNull final Processor<SliceUsage> processor, @NotNull final SliceUsage parent) {
+ Pair<PsiElement, PsiSubstitutor> pair = getAssignmentTarget(element, parent);
+ if (pair != null) {
+ PsiElement target = pair.getFirst();
+ final PsiSubstitutor substitutor = pair.getSecond();
+ if (target instanceof PsiParameter) {
+ PsiParameter parameter = (PsiParameter)target;
+ PsiElement declarationScope = parameter.getDeclarationScope();
+ if (declarationScope instanceof PsiMethod) {
+ final PsiMethod method = (PsiMethod)declarationScope;
+ final int parameterIndex = method.getParameterList().getParameterIndex(parameter);
+
+ Processor<PsiMethod> myProcessor = new Processor<PsiMethod>() {
+ public boolean process(PsiMethod override) {
+ if (!parent.getScope().contains(override)) return true;
+ final PsiSubstitutor superSubstitutor = method == override
+ ? substitutor
+ : MethodSignatureUtil.getSuperMethodSignatureSubstitutor(method.getSignature(substitutor),
+ override.getSignature(substitutor));
+
+ PsiParameter[] parameters = override.getParameterList().getParameters();
+ if (parameters.length <= parameterIndex) return true;
+ PsiParameter actualParam = parameters[parameterIndex];
+
+ SliceUsage usage = SliceUtil.createSliceUsage(actualParam, parent, superSubstitutor);
+ return processor.process(usage);
+ }
+ };
+ if (!myProcessor.process(method)) return false;
+ return OverridingMethodsSearch.search(method, parent.getScope().toSearchScope(), true).forEach(myProcessor);
+ }
+ }
+
SliceUsage usage = SliceUtil.createSliceUsage(target, parent, parent.getSubstitutor());
return processor.process(usage);
}
private static boolean processAssignedFrom(final PsiElement from, final PsiElement context, final SliceUsage parent,
final Processor<SliceUsage> processor) {
if (from instanceof PsiLocalVariable) {
- return ReferencesSearch.search(from).forEach(new Processor<PsiReference>() {
- public boolean process(PsiReference reference) {
- PsiElement element = reference.getElement();
- if (element.getTextOffset() < context.getTextOffset()) return true;
-
- return processAssignmentTarget(element, parent, processor);
- }
- });
+ return searchReferencesAndProcessAssignmentTarget(from, context, parent, processor);
}
if (from instanceof PsiParameter) {
PsiParameter parameter = (PsiParameter)from;
for (final PsiParameter psiParameter : parametersToAnalyze) {
SliceManager.getInstance(from.getProject()).checkCanceled();
- if (!ReferencesSearch.search(psiParameter).forEach(new Processor<PsiReference>() {
- public boolean process(PsiReference reference) {
- SliceManager.getInstance(from.getProject()).checkCanceled();
- PsiElement element = reference.getElement();
-
- return processAssignmentTarget(element, parent, processor);
- }
- })) return false;
+ if (!searchReferencesAndProcessAssignmentTarget(psiParameter, null, parent, processor)) return false;
}
return true;
}
if (from instanceof PsiField) {
- return ReferencesSearch.search(from).forEach(new Processor<PsiReference>() {
- public boolean process(PsiReference reference) {
- SliceManager.getInstance(from.getProject()).checkCanceled();
- PsiElement element = reference.getElement();
- return processAssignmentTarget(element, parent, processor);
- }
- });
+ return searchReferencesAndProcessAssignmentTarget(from, null, parent, processor);
}
if (from instanceof PsiMethod) {
if (!processed.add(reference)) return true;
}
PsiElement element = reference.getElement().getParent();
- if (element instanceof PsiCompiledElement) return true;
return processAssignmentTarget(element, parent, processor);
}
return true;
}
- private static boolean processAssignmentTarget(PsiElement element, SliceUsage parent, Processor<SliceUsage> processor) {
- PsiElement target = getAssignmentTarget(element);
- if (target != null) {
- SliceUsage usage = SliceUtil.createSliceUsage(element, parent, parent.getSubstitutor());
+ private static boolean searchReferencesAndProcessAssignmentTarget(@NotNull PsiElement element, @Nullable final PsiElement context, final SliceUsage parent,
+ final Processor<SliceUsage> processor) {
+ return ReferencesSearch.search(element).forEach(new Processor<PsiReference>() {
+ public boolean process(PsiReference reference) {
+ PsiElement element = reference.getElement();
+ if (context != null && element.getTextOffset() < context.getTextOffset()) return true;
+ return processAssignmentTarget(element, parent, processor);
+ }
+ });
+ }
+
+ private static boolean processAssignmentTarget(PsiElement element, final SliceUsage parent, final Processor<SliceUsage> processor) {
+ Pair<PsiElement, PsiSubstitutor> pair = getAssignmentTarget(element, parent);
+ if (pair != null) {
+ SliceUsage usage = SliceUtil.createSliceUsage(element, parent, pair.getSecond());
return processor.process(usage);
}
return true;
}
- private static PsiElement getAssignmentTarget(PsiElement element) {
+ private static Pair<PsiElement,PsiSubstitutor> getAssignmentTarget(PsiElement element, SliceUsage parentUsage) {
element = complexify(element);
PsiElement target = null;
+ PsiSubstitutor substitutor = parentUsage.getSubstitutor();
//assignment
PsiElement parent = element.getParent();
if (parent instanceof PsiAssignmentExpression) {
if (element.equals(assignment.getRExpression())) {
PsiElement left = assignment.getLExpression();
if (left instanceof PsiReferenceExpression) {
- target = ((PsiReferenceExpression)left).resolve();
+ JavaResolveResult result = ((PsiReferenceExpression)left).advancedResolve(false);
+ target = result.getElement();
+ substitutor = result.getSubstitutor();
}
}
}
PsiExpression[] expressions = ((PsiExpressionList)parent).getExpressions();
int index = ArrayUtil.find(expressions, element);
PsiCallExpression methodCall = (PsiCallExpression)parent.getParent();
- PsiMethod method = methodCall.resolveMethod();
+ JavaResolveResult result = methodCall.resolveMethodGenerics();
+ PsiMethod method = (PsiMethod)result.getElement();
if (index != -1 && method != null) {
PsiParameter[] parameters = method.getParameterList().getParameters();
if (index < parameters.length) {
target = parameters[index];
+ substitutor = result.getSubstitutor();
}
}
}
target = PsiTreeUtil.getParentOfType(statement, PsiMethod.class);
}
}
- if (target instanceof PsiCompiledElement) {
- target = null;
- }
- return target;
+
+ return target == null ? null : Pair.create(target, substitutor);
}
public static PsiElement complexify(@NotNull PsiElement element) {
--- /dev/null
+abc = StrinBui<caret>
\ No newline at end of file
--- /dev/null
+abc = java.lang.StringBuilder<caret>
\ No newline at end of file
--- /dev/null
+class A{
+ void foo() {
+ throw new OurException()<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void foo() {
+ throw new OurNotException.InnerException()<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void foo() {
+ throw new Our<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void foo() {
+ throw new Inner<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+public class OurException extends Throwable{
+
+}
\ No newline at end of file
--- /dev/null
+public class OurNotException {
+ public static class InnerException extends Throwable{
+ }
+ public static class InnerNonException{
+ }
+}
\ No newline at end of file
--- /dev/null
+import pack.AClass;
+
+public class Test1 {
+ public void foo() {
+ new AClass()<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+import pack.WithInnerAClass;
+
+public class Test1 {
+ public void foo() {
+ new WithInnerAClass()<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+public class Test1 {
+ public void foo() {
+ new ACl<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+public class Test1 {
+ public void foo() {
+ new WithInnerACl<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+package pack;
+
+public class AClass{
+}
\ No newline at end of file
--- /dev/null
+package pack;
+
+public class WithInnerAClass{
+ public static class Inner{}
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ Object[] a = new FFFFF<caret>[];
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ Object[] a = new FooFooFooFooFoo<caret>[];
+ }
+}
\ No newline at end of file
--- /dev/null
+class LifeUniverseEverythingEntity {}
+class LifeUniverseEverythingManager {}
+
+class FooFooFooFooFoo {
+ {
+ LUEv<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class LifeUniverseEverythingEntity {}
+class LifeUniverseEverythingManager {}
+
+class FooFooFooFooFoo {
+ {
+ LifeUniverseEverything<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ StringBuf<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ StringBuffer<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ new FFFFF<caret>();
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ new FooFooFooFooFoo()<caret>;
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ int a = 0;
+ ABCD<caret>
+ foo(new String[]{"a"}, 1);
+ }
+}
\ No newline at end of file
--- /dev/null
+import foo.bar.ABCDEF;
+
+class FooFooFooFooFoo {
+ {
+ int a = 0;
+ ABCDEF<caret>
+ foo(new String[]{"a"}, 1);
+ }
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ new FFFFF<caret>(x);
+ }
+
+ FooFooFooFooFoo(int x) {}
+}
\ No newline at end of file
--- /dev/null
+class FooFooFooFooFoo {
+ {
+ new FooFooFooFooFoo(<caret>x);
+ }
+
+ FooFooFooFooFoo(int x) {}
+}
\ No newline at end of file
--- /dev/null
+@interface Column {
+ String name();
+}
+
+@Column(<caret>)
+@interface Annotation {
+
+}
\ No newline at end of file
--- /dev/null
+@interface Column {
+ String name();
+}
+
+Colu<caret>
+@interface Annotation {
+
+}
\ No newline at end of file
--- /dev/null
+import java.io.FileInputStream;
+
+class Main {
+
+ public static void main(String[] args) {
+ equals(FileInputStream<caret>aaa);
+ }
+}
--- /dev/null
+class Main {
+
+ public static void main(String[] args) {
+ equals(FileInputStrea<caret>aaa);
+ }
+}
--- /dev/null
+class Main {
+
+ public static void main(String[] args) {
+ // java.io.FileInputStream<caret>
+ }
+}
--- /dev/null
+class Main {
+
+ public static void main(String[] args) {
+ // java.FileInputStrea<caret>
+ }
+}
--- /dev/null
+import static java.io.FileInputStream<caret>
+
+class Main {
+
+ public static void main(String[] args) {
+ equals(FileInputStrea<caret>aaa);
+ }
+}
--- /dev/null
+import static FileInpStre<caret>
+
+class Main {
+
+ public static void main(String[] args) {
+ equals(FileInputStrea<caret>aaa);
+ }
+}
--- /dev/null
+class Main {
+
+ foo.bar.AxBxCxDxEx<caret>
+}
--- /dev/null
+class Main {
+
+ ABCDE<caret>
+}
--- /dev/null
+class ZZZZZZ{}
+
+class A implements Foo, ZZZZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+class ZZZZZZ{}
+
+class A implements Foo, ZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+class ZZZZZZ{}
+
+class A implements Foo<ZZZZZZ<caret>
\ No newline at end of file
--- /dev/null
+class ZZZZZZ{}
+
+class A implements Foo<ZZZ<caret>
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MyClass1<caret>foo()
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MCla<caret>foo()
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MyClass1<caret>f.oo()
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MCla<caret>f.oo()
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ MyClass1<caret>
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ MyCla<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ aaa.MyObjectType<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ aaa.MyObj<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ MyObjectType<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ MyObj<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ void aaa() {
+ getClass().getAnnotations(MyObjectType<caret>)
+ }
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+@interface MyObjectType {}
+class A {
+ void aaa() {
+ getClass().getAnnotations(MyObject<caret>)
+ }
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MyObjectType {}
+
+class A {
+ MyObjectType<caret>
+}
\ No newline at end of file
--- /dev/null
+package aaa;
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MyObjectType {}
+
+class A {
+ My<caret>
+}
\ No newline at end of file
--- /dev/null
+class Test1 {
+ public void foo(){
+ Test1<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class Test1 {
+ public void foo(){
+ Tes<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class ZZZZZZ{}
+
+class A implements ZZZZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+class ZZZZZZ{}
+
+class A implements ZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+interface ZZZZZZ{}
+
+class A implements ZZZZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+interface ZZZZZZ{}
+
+class A implements ZZZ<caret>{}
\ No newline at end of file
--- /dev/null
+class MyObject {}
+@interface MyObjectType {}
+
+@MyObjectType<caret>
+class A {}
\ No newline at end of file
--- /dev/null
+class MyObject {}
+@interface MyObjectType {}
+
+@MyObj<caret>
+class A {}
\ No newline at end of file
--- /dev/null
+@interface MyObjectType {}
+
+class A {
+ void aaa(@MyObjectType<caret>);
+}
\ No newline at end of file
--- /dev/null
+@interface MyObjectType {}
+
+class A {
+ void aaa(@MyObj<caret>);
+}
\ No newline at end of file
--- /dev/null
+import MyObjectType<caret>
+@interface MyObjectType {}
+class A {}
\ No newline at end of file
--- /dev/null
+import MyObj<caret>
+@interface MyObjectType {}
+class A {}
\ No newline at end of file
--- /dev/null
+import MyObjectType<caret>
+@interface MyObjectType {
+ int param();
+}
+class A {}
\ No newline at end of file
--- /dev/null
+import MyObj<caret>
+@interface MyObjectType {
+ int param();
+}
+class A {}
\ No newline at end of file
--- /dev/null
+@interface MyObjectType {
+ int param();
+}
+class A {
+ void foo() {
+ MyObjectType<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+@interface MyObjectType {
+ int param();
+}
+class A {
+ void foo() {
+ MyOb<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MyClass1<caret>f.oo()
+ }
+}
\ No newline at end of file
--- /dev/null
+class MyClass1 {
+ {
+ MCla<caret>f.oo()
+ }
+}
\ No newline at end of file
--- /dev/null
+cont<caret>
\ No newline at end of file
--- /dev/null
+continue<caret>
\ No newline at end of file
--- /dev/null
+if (true) {
+ whi<caret>
+}
\ No newline at end of file
--- /dev/null
+if (true) {
+ while<caret>
+}
\ No newline at end of file
--- /dev/null
+whiwhiwhi
+ whi<caret>
--- /dev/null
+class Dot1{
+ class A{
+ int a = 0;
+ int foo(){
+ }
+ }
+ static {
+
+ int a = new A().<caret>
+ }
+}
--- /dev/null
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 23.01.2003
+ * Time: 17:06:57
+ * To change this template use Options | File Templates.
+ */
+public class Dot9 {
+ public static class A{
+ public A(){}
+ public void foo(){}
+ }
+
+ public static void main(String[] args) {
+ long[] arr = new long[0];
+ arr.<caret>
+ }
+}
--- /dev/null
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 27.01.2003
+ * Time: 19:35:37
+ * To change this template use Options | File Templates.
+ */
+public class Dot11 extends A {
+ void foo1(){}
+
+ {
+ this.<caret>
+ }
+}
+
+class A{
+ void foo(){}
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 27.01.2003
+ * Time: 19:37:12
+ * To change this template use Options | File Templates.
+ */
+
+public class Dot12 extends A {
+ void foo1(){}
+
+ {
+
+ super.<caret>
+ }
+}
+
+class A{
+ void foo(){}
+}
\ No newline at end of file
--- /dev/null
+class Dot2{
+ class A{
+ static int a = 0;
+ static int foo(){
+ }
+ }
+ static {
+
+ int a = A.<caret>
+ }
+}
--- /dev/null
+class Dot3{
+ class A{
+ int a = 0;
+ int foo(){
+ }
+ }
+ static {
+
+ Object a = new A(){
+ static int foo(){
+ int c = super.<caret>
+ }
+ };
+ }
+}
--- /dev/null
+class Dot4{
+ class A{
+ static int a = 0;
+ int foo(){
+ }
+ }
+ static {
+ int a = new A().<caret>
+ }
+}
--- /dev/null
+import java.<caret>
+
+class Dot5{
+ class A{
+ static int a = 0;
+ int foo(){
+ }
+ }
+ static {
+ int a = new A().
+ }
+}
--- /dev/null
+class Dot6{
+ public static void main(String[] args){
+ int a = args[0].<caret>
+ }
+}
--- /dev/null
+class Dot7{
+ public static void main(String[] args){
+ int a = args.<caret>
+ }
+}
--- /dev/null
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 23.01.2003
+ * Time: 15:04:45
+ * To change this template use Options | File Templates.
+ */
+public class Dot8 {
+
+ {
+ new A().<caret>
+ }
+}
+class A{
+ public String toString(){
+
+ return "".;
+ }
+}
--- /dev/null
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 23.01.2003
+ * Time: 17:06:57
+ * To change this template use Options | File Templates.
+ */
+public class Dot9 {
+ public static class A{
+ public A(){}
+ public void foo(){}
+ }
+
+ public static void main(String[] args) {
+ new A().<caret>
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ x = (ProceedingJoinPoint<? extends <caret>>
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ x = (ProceedingJoinPoint<? ext<caret>>
+ }
+}
--- /dev/null
+public class Xxx {
+
+ <T extends <caret>
+
+}
\ No newline at end of file
--- /dev/null
+public class Xxx {
+
+ <T ext<caret>
+
+}
\ No newline at end of file
--- /dev/null
+class Foo<T extends <caret>A> {
+
+}
--- /dev/null
+class Foo<T ext<caret> A> {
+
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ try {
+
+ } finally {<caret>
+
+ }
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ try {
+
+ } final<caret> {
+
+ }
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ try {
+
+ } finally {
+ <caret>
+ }
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ try {
+
+ } final<caret>
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ if (null<caret>)
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ if (nu<caret>)
+
+ }
+}
--- /dev/null
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(nu<caret>);
+ }
+}
\ No newline at end of file
--- /dev/null
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(Null.nu<caret>);
+ }
+}
\ No newline at end of file
--- /dev/null
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(Null.nu<caret>);
+ }
+}
\ No newline at end of file
--- /dev/null
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(null);
+ }
+}
\ No newline at end of file
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ boolean b = true<caret>
+
+ }
+}
--- /dev/null
+
+public class Main {
+
+ public static void main() {
+ boolean b = tr<caret>
+
+ }
+}
--- /dev/null
+@Deprecated
+<caret>
\ No newline at end of file
--- /dev/null
+public class A{
+ public void method(){
+ try{
+ String str = "";
+ }
+ <caret>
+ }
+}
--- /dev/null
+public <caret>
--- /dev/null
+abstract <caret>
--- /dev/null
+class <caret>
--- /dev/null
+class A{
+<caret>
+}
--- /dev/null
+
+public class Foo {
+ {
+ for(int i;;) { cont<caret> }
+ }
+}
\ No newline at end of file
--- /dev/null
+
+public class Foo {
+ {
+ for(int i;;) { continue; }
+ }
+}
\ No newline at end of file
--- /dev/null
+@interface Foo {
+ String foo() def<caret>
+}
\ No newline at end of file
--- /dev/null
+@interface Foo {
+ String foo() default <caret>
+}
\ No newline at end of file
--- /dev/null
+class x3 <caret>
--- /dev/null
+class A{
+ void <T extends <caret>>foo(){}
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void <T e<caret>>foo(){}
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void <T extends String, V extends <caret>>foo(){}
+}
\ No newline at end of file
--- /dev/null
+class A{
+ void <T extends String, V e<caret>>foo(){}
+}
\ No newline at end of file
--- /dev/null
+class A{
+ {
+ Collection<? extends <caret>>
+ }
+}
\ No newline at end of file
--- /dev/null
+class A{
+ {
+ Collection<? ex<caret>>
+ }
+}
\ No newline at end of file
--- /dev/null
+class AAA{}
+
+class BBB extends <caret>
--- /dev/null
+class AAA{}
+
+interface CCC{}
+
+class BBB extends <caret>
--- /dev/null
+class AAA{}
+
+interface CCC{}
+
+class BBB implements <caret>
--- /dev/null
+class AAA{}
+
+interface BBB extends <caret>
--- /dev/null
+interface AAA{}
+
+interface BBB extends Runnable, <caret>
--- /dev/null
+class AAA{}
+
+class BBB extends AAA implements <caret>
--- /dev/null
+class AAA{}
+
+class BBB extends AAA i<caret>
--- /dev/null
+class AAA{}
+
+class BBB extends AAA implements <caret>{
+}
--- /dev/null
+class AAA{}
+
+class BBB extends AAA i<caret> {
+}
--- /dev/null
+interface AAAA extends <caret>
\ No newline at end of file
--- /dev/null
+interface AAAA e<caret>
\ No newline at end of file
--- /dev/null
+package myPackage;
+
+<caret>
--- /dev/null
+public class A{
+ public void method(){
+ boolean x = this instanceof <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ boolean x = this i<caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ boolean x = super <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ boolean x = super <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ String str = "";
+ boolean x = str instanceof <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ String str = "";
+ boolean x = str i<caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method() <caret> {}
+}
--- /dev/null
+public class A{
+ public void method(<caret>){
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(){
+ <caret>
+ }
+}
--- /dev/null
+public class A{
+ public void method(final String){
+
+ }
+}
--- /dev/null
+public class A{
+ public void method(fi<caret> String){
+
+ }
+}
--- /dev/null
+class B{
+ class A{
+ {
+ B.<caret>
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+class A{
+ {
+ String.<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class A {
+ void foo () {
+ new Runnable () {
+ public synchronized <caret>
+ };
+ }
+}
\ No newline at end of file
--- /dev/null
+class A {
+ void foo () {
+ new Runnable () {
+ public synch<caret>
+ };
+ }
+}
\ No newline at end of file
--- /dev/null
+class Test {
+ void foo() {
+ if (true) {
+ } else synchronized(<caret>)
+ }
+}
--- /dev/null
+class Test {
+ void foo() {
+ if (true) {
+ } else syn<caret>
+ }
+}
--- /dev/null
+
+public class Foo {
+ void foo()
+ th<caret>
+}
\ No newline at end of file
--- /dev/null
+
+public class Foo {
+ void foo()
+ throws <caret>
+}
\ No newline at end of file
--- /dev/null
+public class MessageBean {
+ {
+ String containingClass = ((String) t<caret>
+ }
+}
--- /dev/null
+public class Foo {
+ {
+ if (Bar.<caret>)
+ }
+}
+
+class Bar {
+
+ public static void voidMethod() {}
+ public static boolean booleanMethod() {}
+ public static final boolean BOOLEAN = true;
+ public static final Object AN_OBJECT = "";
+
+ public static class Inner {}
+
+
+}
--- /dev/null
+public class Foo {
+ {
+ Bar.<caret>
+ }
+}
+
+class Bar {
+
+ public static void voidMethod() {}
+ public static boolean booleanMethod() {}
+ public static final boolean BOOLEAN = true;
+ public static final Object AN_OBJECT = "";
+
+ public static class Inner {}
+
+
+}
--- /dev/null
+public class Aaaaaaa {
+ private final String aaa;
+
+ Aaaaaaa(String aabbb) {
+ aaa = true ? null : aa<caret>
+ }
+
+}
--- /dev/null
+public class Aaaaaaa {
+ private final String aaa;
+
+ Aaaaaaa(Object aabbb) {
+ aaa = true ? null : aa<caret>
+ }
+
+}
--- /dev/null
+class Foo {
+
+ void register(int registrar) {
+ regi<caret>
+ }
+
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+
+ int register() {
+ re<caret>
+ }
+
+}
\ No newline at end of file
--- /dev/null
+public class ServiceManager {
+
+ public static <T> T getService(Class<T> serviceClass) {
+ }
+
+ public static <T> T getService(Project project, Class<T> serviceClass) {
+ }
+
+}
+
+
+class Foo {
+ String getFoo() {
+ return ServiceManager.<caret>
+ }
+
+}
\ No newline at end of file
--- /dev/null
+public class Beda {
+ {
+ Object clsLoader;
+ cL<caret>
+ }
+}
--- /dev/null
+@interface Anno {
+ String value();
+ String name();
+}
+
+@Anno(<caret>)
+class Foo {}
\ No newline at end of file
--- /dev/null
+class Foo {
+ String getName() {}
+ Foo getNameIdentifier() {}
+}
+
+class Bar {
+ void foo() {
+ Foo f;
+ if ("abc".equals(f.getN<caret>))
+ }
+}
\ No newline at end of file
--- /dev/null
+public class MyFirstTestClassFoo {
+
+ void foo(int a) {}
+ void foo() {}
+ void foo(int a, int b) {}
+ void fox(int a) {}
+
+ {
+ new MyFirstTestClassFoo().fo<caret>
+ }
+
+}
--- /dev/null
+class Foo {
+ void bar() {}
+ void foo() {}
+}
+
+class Bar extends Foo {
+ void foo() {
+ super.<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+ boolean zoo(String s) {
+ return f<caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+<p<caret>
\ No newline at end of file
--- /dev/null
+class Foo {
+ String fooLongButOfDefaultType() {}
+ Foo foo() {}
+}
+
+class Bar {
+ void foo() {
+ Foo f;
+ if ("abc".equals(f.fo<caret>))
+ }
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+ void foo(String s) {}
+ {
+ foo("aaa".sub<caret>)
+ }
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+ {
+ Object classLoader;
+ Object classBeforeLoader;
+ cL<caret>
+ }
+
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+ {
+ Object classLoader;
+ Object classLoader2;
+ cL<caret>
+ }
+
+}
\ No newline at end of file
+++ /dev/null
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<html>
- <head><title>Simple jsp page</title></head>
- <body><%=System.currentTimeMillis()<caret>%></body>
-</html>
\ No newline at end of file
+++ /dev/null
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<html>
- <head><title>Simple jsp page</title></head>
- <body><%=System.cur<caret>%></body>
-</html>
\ No newline at end of file
--- /dev/null
+public abstract class Foo {
+
+ void foo(Boolean value);
+
+ {
+ boolean b;
+ foo(<caret>)
+ }
+
+}
\ No newline at end of file
--- /dev/null
+public class Foo {
+
+ public Class<? extends String> foo() {
+ return <caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+class Foo {
+ {
+ Object _o;
+ Bar b;
+ if (_o instanceof Goo) {
+ Goo g = <caret>
+ }
+ }
+}
+
+class Goo {
+
+}
+
+class Bar extends Goo {
+
+}
\ No newline at end of file
--- /dev/null
+public class Foo {
+
+ {
+ String name;
+ Object o1;
+ Foo foo;
+
+ Object o = <caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+enum MyEnum {
+ FOO, BAR;
+}
+
+public class Foo {
+
+ {
+ MyEnum e;
+ MyEnum e1 = <caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+enum MyEnum {
+ FOO, BAR;
+}
+
+public class Foo {
+
+ MyEnum bar() {}
+
+ MyEnum foo() {
+ MyEnum e;
+ return <caret>
+ }
+}
\ No newline at end of file
--- /dev/null
+interface MyProcessor<T> {
+ void execute(T t);
+}
+
+class Proc1<T> implements MyProcessor<T> { public void execute(T t) {}}
+
+class Foo {
+ MyProcessor<Foo> p = new <caret>
+}
\ No newline at end of file