mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+2
-3
@@ -53,8 +53,7 @@ public class ArchiveAntCopyInstructionCreator implements AntCopyInstructionCreat
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar) {
|
||||
final String pattern = pathInJar.length() == 0 ? null : pathInJar + "**";
|
||||
return ZipFileSet.createUnpackedSet(jarPath, pathInJar, true, pattern);
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) {
|
||||
return ZipFileSet.createUnpackedSet(jarPath, myPrefix, true);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -58,13 +58,7 @@ public class DirectoryAntCopyInstructionCreator implements AntCopyInstructionCre
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar) {
|
||||
final Unzip unzip = new Unzip(jarPath, myOutputDirectory);
|
||||
if (pathInJar.length() > 0) {
|
||||
final PatternSet patterns = new PatternSet(null);
|
||||
patterns.add(new Include(pathInJar + "**"));
|
||||
unzip.add(patterns);
|
||||
}
|
||||
return unzip;
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) {
|
||||
return new Unzip(jarPath, myOutputDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-9
@@ -48,14 +48,14 @@ public class ArtifactElementType extends ComplexPackagingElementType<ArtifactPac
|
||||
|
||||
@Override
|
||||
public boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact) {
|
||||
return !getAvailableArtifacts(context, artifact).isEmpty();
|
||||
return !getAvailableArtifacts(context, artifact, false).isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends ArtifactPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final Project project = context.getProject();
|
||||
List<Artifact> artifacts = context.chooseArtifacts(getAvailableArtifacts(context, artifact), CompilerBundle.message("dialog.title.choose.artifacts"));
|
||||
List<Artifact> artifacts = context.chooseArtifacts(getAvailableArtifacts(context, artifact, false), CompilerBundle.message("dialog.title.choose.artifacts"));
|
||||
final List<ArtifactPackagingElement> elements = new ArrayList<ArtifactPackagingElement>();
|
||||
for (Artifact selected : artifacts) {
|
||||
elements.add(new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(selected, context.getArtifactModel())));
|
||||
@@ -64,14 +64,18 @@ public class ArtifactElementType extends ComplexPackagingElementType<ArtifactPac
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<? extends Artifact> getAvailableArtifacts(@NotNull final ArtifactEditorContext context, @NotNull final Artifact artifact) {
|
||||
public static List<? extends Artifact> getAvailableArtifacts(@NotNull final ArtifactEditorContext context,
|
||||
@NotNull final Artifact artifact,
|
||||
final boolean notIncludedOnly) {
|
||||
final Set<Artifact> result = new HashSet<Artifact>(Arrays.asList(context.getArtifactModel().getArtifacts()));
|
||||
ArtifactUtil.processPackagingElements(artifact, ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
|
||||
public boolean process(ArtifactPackagingElement artifactPackagingElement) {
|
||||
result.remove(artifactPackagingElement.findArtifact(context));
|
||||
return true;
|
||||
}
|
||||
}, context, true);
|
||||
if (notIncludedOnly) {
|
||||
ArtifactUtil.processPackagingElements(artifact, ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
|
||||
public boolean process(ArtifactPackagingElement artifactPackagingElement) {
|
||||
result.remove(artifactPackagingElement.findArtifact(context));
|
||||
return true;
|
||||
}
|
||||
}, context, true);
|
||||
}
|
||||
result.remove(artifact);
|
||||
final Iterator<Artifact> iterator = result.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
||||
+23
-1
@@ -15,7 +15,12 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.compiler.ant.BuildProperties;
|
||||
import com.intellij.compiler.ant.Generator;
|
||||
import com.intellij.compiler.ant.taskdefs.Include;
|
||||
import com.intellij.compiler.ant.taskdefs.Mkdir;
|
||||
import com.intellij.compiler.ant.taskdefs.PatternSet;
|
||||
import com.intellij.compiler.ant.taskdefs.Unzip;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
@@ -25,6 +30,7 @@ import com.intellij.packaging.elements.*;
|
||||
import com.intellij.packaging.impl.ui.ExtractedDirectoryPresentation;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -73,7 +79,23 @@ public class ExtractedDirectoryPackagingElement extends FileOrDirectoryCopyPacka
|
||||
@NotNull ArtifactAntGenerationContext generationContext,
|
||||
@NotNull ArtifactType artifactType) {
|
||||
final String jarPath = generationContext.getSubstitutedPath(myFilePath);
|
||||
return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath, StringUtil.trimStart(myPathInJar, "/")));
|
||||
final String pathInJar = StringUtil.trimStart(myPathInJar, "/");
|
||||
if (pathInJar.length() == 0) {
|
||||
return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath));
|
||||
}
|
||||
|
||||
final String archiveName = PathUtil.getFileName(myFilePath);
|
||||
final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName);
|
||||
final String tempDirPath = BuildProperties.propertyRef(tempDirProperty);
|
||||
generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath));
|
||||
|
||||
final Unzip unzip = new Unzip(jarPath, tempDirPath);
|
||||
final PatternSet patterns = new PatternSet(null);
|
||||
patterns.add(new Include(pathInJar + "**"));
|
||||
unzip.add(patterns);
|
||||
generationContext.runBeforeCurrentArtifact(unzip);
|
||||
|
||||
return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,11 +43,10 @@ public class ZipFileSet extends Tag{
|
||||
pair("prefix", prefix(isDir, relativePath)));
|
||||
}
|
||||
|
||||
public static ZipFileSet createUnpackedSet(@NonNls String zipFilePath, @NotNull String relativePath, final boolean isDir, String pattern) {
|
||||
public static ZipFileSet createUnpackedSet(@NonNls String zipFilePath, @NotNull String relativePath, final boolean isDir) {
|
||||
return new ZipFileSet("zipfileset",
|
||||
pair("src", zipFilePath),
|
||||
pair("prefix", prefix(isDir, relativePath)),
|
||||
pair("includes", pattern));
|
||||
pair("prefix", prefix(isDir, relativePath)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -38,5 +38,5 @@ public interface AntCopyInstructionCreator {
|
||||
Generator createSubFolderCommand(@NotNull String directoryName);
|
||||
|
||||
@NotNull
|
||||
Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar);
|
||||
Generator createExtractedDirectoryInstruction(@NotNull String jarPath);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.util.importProject;
|
||||
|
||||
import com.intellij.ide.util.JavaUtil;
|
||||
import com.intellij.lexer.JavaLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -45,7 +46,7 @@ import java.util.zip.ZipFile;
|
||||
public class ModuleInsight {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.importProject.ModuleInsight");
|
||||
@NotNull private final ProgressIndicatorWrapper myProgress;
|
||||
|
||||
|
||||
private final Set<File> myEntryPointRoots = new HashSet<File>();
|
||||
private final List<Pair<File, String>> mySourceRoots = new ArrayList<Pair<File, String>>(); // list of Pair: [sourceRoot-> package prefix]
|
||||
private final Set<String> myIgnoredNames = new HashSet<String>();
|
||||
@@ -62,7 +63,7 @@ public class ModuleInsight {
|
||||
public ModuleInsight(@Nullable final ProgressIndicator progress) {
|
||||
this(progress, Collections.<File>emptyList(), Collections.<Pair<File,String>>emptyList(), Collections.<String>emptySet());
|
||||
}
|
||||
|
||||
|
||||
public ModuleInsight(@Nullable final ProgressIndicator progress, List<File> entryPointRoots, List<Pair<File,String>> sourceRoots, final Set<String> ignoredNames) {
|
||||
myLexer = new JavaLexer(LanguageLevel.JDK_1_5);
|
||||
myProgress = new ProgressIndicatorWrapper(progress);
|
||||
@@ -72,16 +73,16 @@ public class ModuleInsight {
|
||||
public final void setRoots(final List<File> contentRoots, final List<Pair<File, String>> sourceRoots, final Set<String> ignoredNames) {
|
||||
myModules = null;
|
||||
myLibraries = null;
|
||||
|
||||
|
||||
myEntryPointRoots.clear();
|
||||
myEntryPointRoots.addAll(contentRoots);
|
||||
|
||||
|
||||
mySourceRoots.clear();
|
||||
mySourceRoots.addAll(sourceRoots);
|
||||
|
||||
|
||||
myIgnoredNames.clear();
|
||||
myIgnoredNames.addAll(ignoredNames);
|
||||
|
||||
|
||||
myJarToPackagesMap.clear();
|
||||
myInterner.clear();
|
||||
}
|
||||
@@ -102,22 +103,22 @@ public class ModuleInsight {
|
||||
|
||||
try {
|
||||
myProgress.pushState();
|
||||
|
||||
|
||||
for (Pair<File, String> pair : mySourceRoots) {
|
||||
final File sourceRoot = pair.getFirst();
|
||||
if (myIgnoredNames.contains(sourceRoot.getName())) {
|
||||
continue;
|
||||
}
|
||||
myProgress.setText("Scanning " + sourceRoot.getPath());
|
||||
|
||||
|
||||
final HashSet<String> usedPackages = new HashSet<String>();
|
||||
mySourceRootToReferencedPackagesMap.put(sourceRoot, usedPackages);
|
||||
|
||||
|
||||
final HashSet<String> selfPackages = new HashSet<String>();
|
||||
mySourceRootToPackagesMap.put(sourceRoot, selfPackages);
|
||||
|
||||
|
||||
scanSources(sourceRoot, pair.getSecond(), usedPackages, selfPackages) ;
|
||||
usedPackages.removeAll(selfPackages);
|
||||
usedPackages.removeAll(selfPackages);
|
||||
}
|
||||
myProgress.popState();
|
||||
|
||||
@@ -137,12 +138,12 @@ public class ModuleInsight {
|
||||
// build dependencies
|
||||
|
||||
buildModuleDependencies(contentRootToModules);
|
||||
|
||||
|
||||
myProgress.popState();
|
||||
}
|
||||
catch (ProcessCanceledException ignored) {
|
||||
}
|
||||
|
||||
|
||||
myModules = new ArrayList<ModuleDescriptor>(contentRootToModules.values());
|
||||
final Set<String> moduleNames = new HashSet<String>();
|
||||
for (ModuleDescriptor module : myModules) {
|
||||
@@ -158,7 +159,7 @@ public class ModuleInsight {
|
||||
for (File contentRoot : moduleContentRoots) {
|
||||
final ModuleDescriptor checkedModule = contentRootToModules.get(contentRoot);
|
||||
myProgress.setText2("Building library dependencies for module " + checkedModule.getName());
|
||||
|
||||
|
||||
// attach libraries
|
||||
buildJarDependencies(checkedModule);
|
||||
|
||||
@@ -209,8 +210,8 @@ public class ModuleInsight {
|
||||
}
|
||||
myProgress.setText("Building initial libraries layout...");
|
||||
final List<LibraryDescriptor> libraries = buildInitialLibrariesLayout(myJarToPackagesMap.keySet());
|
||||
// correct library names so that there are no duplicates
|
||||
final Set<String> libNames = new HashSet<String>();
|
||||
// correct library names so that there are no duplicates
|
||||
final Set<String> libNames = new HashSet<String>();
|
||||
for (LibraryDescriptor library : libraries) {
|
||||
final Collection<File> libJars = library.getJars();
|
||||
final String newName = suggestUniqueName(libNames, libJars.size() == 1? libJars.iterator().next().getName() : library.getName());
|
||||
@@ -223,7 +224,7 @@ public class ModuleInsight {
|
||||
myProgress.popState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String suggestUniqueName(Set<String> existingNames, String baseName) {
|
||||
String name = baseName;
|
||||
int index = 1;
|
||||
@@ -250,7 +251,7 @@ public class ModuleInsight {
|
||||
mainModule.addDependencyOn(dependency);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
myModules.remove(module);
|
||||
// fix back dependencies
|
||||
for (ModuleDescriptor moduleDescr : myModules) {
|
||||
@@ -272,7 +273,7 @@ public class ModuleInsight {
|
||||
}
|
||||
return newLibrary;
|
||||
}
|
||||
|
||||
|
||||
public ModuleDescriptor splitModule(final ModuleDescriptor descriptor, String newModuleName, final Collection<File> contentsToExtract) {
|
||||
ModuleDescriptor newModule = null;
|
||||
for (File root : contentsToExtract) {
|
||||
@@ -291,7 +292,7 @@ public class ModuleInsight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (newModule != null) {
|
||||
newModule.setName(newModuleName);
|
||||
myModules.add(newModule);
|
||||
@@ -299,7 +300,7 @@ public class ModuleInsight {
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
final Map<File, ModuleDescriptor> contentRootToModule = new HashMap<File, ModuleDescriptor>();
|
||||
for (ModuleDescriptor module : myModules) {
|
||||
final Set<File> roots = module.getContentRoots();
|
||||
@@ -309,15 +310,15 @@ public class ModuleInsight {
|
||||
module.clearModuleDependencies();
|
||||
module.clearLibraryFiles();
|
||||
}
|
||||
|
||||
|
||||
buildModuleDependencies(contentRootToModule);
|
||||
return newModule;
|
||||
}
|
||||
|
||||
|
||||
public void removeLibrary(LibraryDescriptor lib) {
|
||||
myLibraries.remove(lib);
|
||||
}
|
||||
|
||||
|
||||
public void moveJarsToLibrary(final LibraryDescriptor from, Collection<File> files, LibraryDescriptor to) {
|
||||
to.addJars(files);
|
||||
from.removeJars(files);
|
||||
@@ -326,14 +327,14 @@ public class ModuleInsight {
|
||||
removeLibrary(from);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LibraryDescriptor extractToNewLibrary(final LibraryDescriptor from, Collection<File> jars, String libraryName) {
|
||||
final LibraryDescriptor libraryDescriptor = new LibraryDescriptor(libraryName, new HashSet<File>());
|
||||
myLibraries.add(libraryDescriptor);
|
||||
moveJarsToLibrary(from, jars, libraryDescriptor);
|
||||
return libraryDescriptor;
|
||||
}
|
||||
|
||||
|
||||
public Collection<LibraryDescriptor> getLibraryDependencies(ModuleDescriptor module) {
|
||||
final Set<LibraryDescriptor> libs = new HashSet<LibraryDescriptor>();
|
||||
for (LibraryDescriptor library : myLibraries) {
|
||||
@@ -343,7 +344,7 @@ public class ModuleInsight {
|
||||
}
|
||||
return libs;
|
||||
}
|
||||
|
||||
|
||||
private static File appendContentRoot(final ModuleDescriptor module, final File contentRoot) {
|
||||
final Set<File> moduleRoots = module.getContentRoots();
|
||||
for (File moduleRoot : moduleRoots) {
|
||||
@@ -367,8 +368,8 @@ public class ModuleInsight {
|
||||
module.addContentRoot(contentRoot);
|
||||
return contentRoot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static List<LibraryDescriptor> buildInitialLibrariesLayout(final Set<File> jars) {
|
||||
final Map<File, LibraryDescriptor> rootToLibraryMap = new HashMap<File, LibraryDescriptor>();
|
||||
for (File jar : jars) {
|
||||
@@ -420,7 +421,7 @@ public class ModuleInsight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void scanJavaFile(File file, final Set<String> usedPackages) {
|
||||
myProgress.setText2(file.getName());
|
||||
try {
|
||||
@@ -431,7 +432,7 @@ public class ModuleInsight {
|
||||
LOG.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void scanRootForLibraries(File fromRoot) {
|
||||
if (myIgnoredNames.contains(fromRoot.getName())) {
|
||||
return;
|
||||
@@ -449,7 +450,7 @@ public class ModuleInsight {
|
||||
if (!myJarToPackagesMap.containsKey(file)) {
|
||||
final HashSet<String> libraryPackages = new HashSet<String>();
|
||||
myJarToPackagesMap.put(file, libraryPackages);
|
||||
|
||||
|
||||
scanLibrary(file, libraryPackages);
|
||||
}
|
||||
}
|
||||
@@ -457,8 +458,8 @@ public class ModuleInsight {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void scanLibrary(File file, Set<String> libraryPackages) {
|
||||
myProgress.pushState();
|
||||
myProgress.setText2(file.getName());
|
||||
@@ -489,18 +490,18 @@ public class ModuleInsight {
|
||||
myProgress.popState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void scanImportStatements(char[] text, final Lexer lexer, final Set<String> usedPackages){
|
||||
lexer.start(new CharArrayCharSequence(text));
|
||||
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
|
||||
JavaUtil.skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() == JavaTokenType.PACKAGE_KEYWORD) {
|
||||
advanceLexer(lexer);
|
||||
if (readPackageName(text, lexer) == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (true) {
|
||||
if (lexer.getTokenType() == JavaTokenType.SEMICOLON) {
|
||||
advanceLexer(lexer);
|
||||
@@ -509,18 +510,18 @@ public class ModuleInsight {
|
||||
return;
|
||||
}
|
||||
advanceLexer(lexer);
|
||||
|
||||
|
||||
boolean isStaticImport = false;
|
||||
if (lexer.getTokenType() == JavaTokenType.STATIC_KEYWORD) {
|
||||
isStaticImport = true;
|
||||
advanceLexer(lexer);
|
||||
}
|
||||
|
||||
|
||||
final String packageName = readPackageName(text, lexer);
|
||||
if (packageName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (packageName.endsWith(".*")) {
|
||||
usedPackages.add(myInterner.intern(packageName.substring(0, packageName.length() - ".*".length())));
|
||||
}
|
||||
@@ -572,14 +573,6 @@ public class ModuleInsight {
|
||||
|
||||
private static void advanceLexer(final Lexer lexer) {
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
JavaUtil.skipWhiteSpaceAndComments(lexer);
|
||||
}
|
||||
|
||||
private static void skipWhiteSpaceAndComments(Lexer lexer){
|
||||
while(JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(lexer.getTokenType())) {
|
||||
lexer.advance();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -39,13 +39,13 @@ public class ArtifactsSourceItemsProvider extends PackagingSourceItemsProvider {
|
||||
@NotNull Artifact artifact,
|
||||
@Nullable PackagingSourceItem parent) {
|
||||
if (parent == null) {
|
||||
if (!ArtifactElementType.getAvailableArtifacts(editorContext, artifact).isEmpty()) {
|
||||
if (!ArtifactElementType.getAvailableArtifacts(editorContext, artifact, true).isEmpty()) {
|
||||
return Collections.singletonList(new ArtifactsGroupSourceItem());
|
||||
}
|
||||
}
|
||||
else if (parent instanceof ArtifactsGroupSourceItem) {
|
||||
List<PackagingSourceItem> items = new ArrayList<PackagingSourceItem>();
|
||||
for (Artifact another : ArtifactElementType.getAvailableArtifacts(editorContext, artifact)) {
|
||||
for (Artifact another : ArtifactElementType.getAvailableArtifacts(editorContext, artifact, true)) {
|
||||
items.add(new ArtifactSourceItem(another));
|
||||
}
|
||||
return items;
|
||||
|
||||
+3
-2
@@ -46,6 +46,7 @@ import com.intellij.psi.filters.element.ExcludeDeclaredFilter;
|
||||
import com.intellij.psi.filters.element.ModifierFilter;
|
||||
import com.intellij.psi.filters.getters.ExpectedTypesGetter;
|
||||
import com.intellij.psi.filters.types.AssignableFromFilter;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.scope.ElementClassFilter;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -530,14 +531,14 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
return true;
|
||||
}
|
||||
|
||||
while (!iterator.atEnd() && JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(iterator.getTokenType())) {
|
||||
while (!iterator.atEnd() && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(iterator.getTokenType())) {
|
||||
iterator.advance();
|
||||
}
|
||||
|
||||
if (iterator.atEnd() || iterator.getTokenType() != JavaTokenType.IDENTIFIER) return false;
|
||||
iterator.advance();
|
||||
|
||||
while (!iterator.atEnd() && JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(iterator.getTokenType())) {
|
||||
while (!iterator.atEnd() && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(iterator.getTokenType())) {
|
||||
iterator.advance();
|
||||
}
|
||||
if (iterator.atEnd()) return false;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -87,7 +88,7 @@ public abstract class RParenthTailType extends TailType {
|
||||
for(HighlighterIterator iterator = highlighter.createIterator(tailOffset); !iterator.atEnd(); iterator.advance()){
|
||||
final IElementType tokenType = iterator.getTokenType();
|
||||
|
||||
if ((!(tokenType instanceof IJavaElementType) || !JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(tokenType)) &&
|
||||
if ((!(tokenType instanceof IJavaElementType) || !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(tokenType)) &&
|
||||
tokenType != TokenType.WHITE_SPACE) {
|
||||
final int start = iterator.getStart();
|
||||
if (iterator.getEnd() == start + 1 && ')' == charsSequence.charAt(start)) {
|
||||
|
||||
@@ -181,26 +181,30 @@ public class PostHighlightingPass extends TextEditorHighlightingPass {
|
||||
|
||||
private void optimizeImportsOnTheFly() {
|
||||
if (myHasRedundantImports || myHasMissortedImports) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
invokeOnTheFlyImportOptimizer(new Runnable() {
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
OptimizeImportsFix optimizeImportsFix = new OptimizeImportsFix();
|
||||
if (optimizeImportsFix.isAvailable(myProject, myEditor, myFile) && myFile.isWritable()) {
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
optimizeImportsFix.invoke(myProject, myEditor, myFile);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
OptimizeImportsFix optimizeImportsFix = new OptimizeImportsFix();
|
||||
if (optimizeImportsFix.isAvailable(myProject, myEditor, myFile) && myFile.isWritable()) {
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
optimizeImportsFix.invoke(myProject, myEditor, myFile);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void invokeOnTheFlyImportOptimizer(final Runnable runnable) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(runnable);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public Collection<HighlightInfo> getHighlights() {
|
||||
return myHighlights;
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.jsp.jspJava.JspHolderMethod;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
@@ -241,7 +242,7 @@ public class HighlightNamesUtil {
|
||||
do {
|
||||
node = TreeUtil.nextLeaf(node);
|
||||
}
|
||||
while (node != null && JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(node.getElementType()));
|
||||
while (node != null && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(node.getElementType()));
|
||||
}
|
||||
if (node != null) return node.getTextRange().getStartOffset();
|
||||
return textRange.getStartOffset();
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -88,7 +89,7 @@ public class JavaQuoteHandler extends SimpleTokenSetQuoteHandler implements Java
|
||||
}
|
||||
|
||||
public static boolean isAppropriateElementTypeForLiteralStatic(final IElementType tokenType) {
|
||||
return TokenTypeEx.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(tokenType)
|
||||
return ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(tokenType)
|
||||
|| tokenType == JavaTokenType.SEMICOLON
|
||||
|| tokenType == JavaTokenType.COMMA
|
||||
|| tokenType == JavaTokenType.RPARENTH
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -63,7 +64,7 @@ public class SemicolonFixer implements Fixer {
|
||||
|
||||
int tailLength = 0;
|
||||
ASTNode leaf = TreeUtil.findLastLeaf(psiElement.getNode());
|
||||
while (JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(leaf.getElementType())) {
|
||||
while (ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(leaf.getElementType())) {
|
||||
tailLength += leaf.getTextLength();
|
||||
leaf = TreeUtil.prevLeaf(leaf);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.BracePair;
|
||||
import com.intellij.lang.PairedBraceMatcher;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,7 +44,7 @@ public class JavaBraceMatcher implements PairedBraceMatcher {
|
||||
}
|
||||
|
||||
private static boolean isPairedBracesAllowedBeforeTypeInJava(final IElementType tokenType) {
|
||||
return TokenTypeEx.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(tokenType)
|
||||
return ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(tokenType)
|
||||
|| tokenType == JavaTokenType.SEMICOLON
|
||||
|| tokenType == JavaTokenType.COMMA
|
||||
|| tokenType == JavaTokenType.RPARENTH
|
||||
|
||||
@@ -28,7 +28,10 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.text.CharArrayCharSequence;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -37,26 +40,27 @@ import java.util.List;
|
||||
|
||||
|
||||
public class JavaUtil {
|
||||
private JavaUtil() { }
|
||||
|
||||
public static List<Pair<File,String>> suggestRoots(File dir) {
|
||||
ArrayList<Pair<File,String>> foundDirectories = new ArrayList<Pair<File, String>>();
|
||||
try{
|
||||
suggestRootsImpl(dir, dir, foundDirectories);
|
||||
}
|
||||
catch(PathFound found){
|
||||
catch(PathFoundException ignore){
|
||||
}
|
||||
return foundDirectories;
|
||||
}
|
||||
|
||||
private static class PathFound extends Exception {
|
||||
private static class PathFoundException extends Exception {
|
||||
public File myDirectory;
|
||||
|
||||
public PathFound(File directory) {
|
||||
public PathFoundException(File directory) {
|
||||
myDirectory = directory;
|
||||
}
|
||||
}
|
||||
|
||||
private static void suggestRootsImpl(File base, File dir, ArrayList<? super Pair<File, String>> foundDirectories) throws PathFound {
|
||||
private static void suggestRootsImpl(File base, File dir, ArrayList<? super Pair<File, String>> foundDirectories) throws PathFoundException {
|
||||
if (!dir.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +96,7 @@ public class JavaUtil {
|
||||
else {
|
||||
foundDirectories.add(Pair.create(base, packagePrefix));
|
||||
}
|
||||
throw new PathFound(root.getFirst());
|
||||
throw new PathFoundException(root.getFirst());
|
||||
}
|
||||
else {
|
||||
return;
|
||||
@@ -106,7 +110,7 @@ public class JavaUtil {
|
||||
try {
|
||||
suggestRootsImpl(base, child, foundDirectories);
|
||||
}
|
||||
catch (PathFound found) {
|
||||
catch (PathFoundException found) {
|
||||
if (!found.myDirectory.equals(child)) {
|
||||
throw found;
|
||||
}
|
||||
@@ -115,6 +119,7 @@ public class JavaUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getPackagePrefix(File base, Pair<File,String> root) {
|
||||
String result = "";
|
||||
for (File parent = base; parent != null; parent = parent.getParentFile()) {
|
||||
@@ -127,68 +132,75 @@ public class JavaUtil {
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private static Pair<File,String> suggestRootForJavaFile(File javaFile) {
|
||||
if (!javaFile.isFile()) {
|
||||
return null;
|
||||
}
|
||||
if (!javaFile.isFile()) return null;
|
||||
|
||||
final CharSequence chars;
|
||||
try {
|
||||
final CharSequence chars = new CharArrayCharSequence(FileUtil.loadFileText(javaFile));
|
||||
|
||||
String packageName = getPackageStatement(chars);
|
||||
if (packageName != null) {
|
||||
File root = javaFile.getParentFile();
|
||||
int index = packageName.length();
|
||||
while (index > 0) {
|
||||
int index1 = packageName.lastIndexOf('.', index - 1);
|
||||
String token = packageName.substring(index1 + 1, index);
|
||||
String dirName = root.getName();
|
||||
final boolean equalsToToken = SystemInfo.isFileSystemCaseSensitive ? dirName.equals(token) : dirName.equalsIgnoreCase(token);
|
||||
if (!equalsToToken) {
|
||||
return Pair.create(root, packageName.substring(0, index));
|
||||
}
|
||||
String parent = root.getParent();
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
root = new File(parent);
|
||||
index = index1;
|
||||
}
|
||||
return Pair.create(root, "");
|
||||
}
|
||||
chars = new CharArrayCharSequence(FileUtil.loadFileText(javaFile));
|
||||
}
|
||||
catch(IOException e){
|
||||
return null;
|
||||
}
|
||||
|
||||
String packageName = getPackageStatement(chars);
|
||||
if (packageName != null) {
|
||||
File root = javaFile.getParentFile();
|
||||
int index = packageName.length();
|
||||
while (index > 0) {
|
||||
int index1 = packageName.lastIndexOf('.', index - 1);
|
||||
String token = packageName.substring(index1 + 1, index);
|
||||
String dirName = root.getName();
|
||||
final boolean equalsToToken = SystemInfo.isFileSystemCaseSensitive ? dirName.equals(token) : dirName.equalsIgnoreCase(token);
|
||||
if (!equalsToToken) {
|
||||
return Pair.create(root, packageName.substring(0, index));
|
||||
}
|
||||
String parent = root.getParent();
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
root = new File(parent);
|
||||
index = index1;
|
||||
}
|
||||
return Pair.create(root, "");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getPackageStatement(CharSequence text){
|
||||
@Nullable
|
||||
public static String getPackageStatement(CharSequence text){
|
||||
Lexer lexer = new JavaLexer(LanguageLevel.JDK_1_3);
|
||||
lexer.start(text);
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() != JavaTokenType.PACKAGE_KEYWORD) return "";
|
||||
if (lexer.getTokenType() != JavaTokenType.PACKAGE_KEYWORD) return null;
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
while(true){
|
||||
if (lexer.getTokenType() != JavaTokenType.IDENTIFIER) break;
|
||||
buffer.append(text, lexer.getTokenStart(), lexer.getTokenEnd());
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() != JavaTokenType.DOT) break;
|
||||
buffer.append('.');
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
|
||||
final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
|
||||
try {
|
||||
while(true){
|
||||
if (lexer.getTokenType() != JavaTokenType.IDENTIFIER) break;
|
||||
buffer.append(text, lexer.getTokenStart(), lexer.getTokenEnd());
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() != JavaTokenType.DOT) break;
|
||||
buffer.append('.');
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
}
|
||||
String packageName = buffer.toString();
|
||||
if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.')) return null;
|
||||
return packageName;
|
||||
}
|
||||
finally {
|
||||
StringBuilderSpinAllocator.dispose(buffer);
|
||||
}
|
||||
String packageName = buffer.toString();
|
||||
if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.')) return null;
|
||||
return packageName;
|
||||
}
|
||||
|
||||
private static void skipWhiteSpaceAndComments(Lexer lexer){
|
||||
while(JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(lexer.getTokenType())) {
|
||||
public static void skipWhiteSpaceAndComments(Lexer lexer){
|
||||
while(ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(lexer.getTokenType())) {
|
||||
lexer.advance();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ide.util;
|
||||
|
||||
import com.intellij.lexer.JavaLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
@@ -26,8 +24,6 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -51,8 +47,7 @@ public class JavaUtilForVfs {
|
||||
try{
|
||||
suggestRootsImpl(dir, foundDirectories);
|
||||
}
|
||||
catch(PathFoundException found){
|
||||
// OK
|
||||
catch(PathFoundException ignore){
|
||||
}
|
||||
return foundDirectories;
|
||||
}
|
||||
@@ -127,7 +122,7 @@ public class JavaUtilForVfs {
|
||||
|
||||
CharSequence chars = LoadTextUtil.loadText(javaFile);
|
||||
|
||||
String packageName = getPackageStatement(chars);
|
||||
String packageName = JavaUtil.getPackageStatement(chars);
|
||||
if (packageName != null){
|
||||
VirtualFile root = javaFile.getParent();
|
||||
int index = packageName.length();
|
||||
@@ -150,34 +145,4 @@ public class JavaUtilForVfs {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getPackageStatement(CharSequence text){
|
||||
Lexer lexer = new JavaLexer(LanguageLevel.JDK_1_3);
|
||||
lexer.start(text);
|
||||
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() != JavaTokenType.PACKAGE_KEYWORD) return null;
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
while(true){
|
||||
if (lexer.getTokenType() != JavaTokenType.IDENTIFIER) break;
|
||||
buffer.append(text, lexer.getTokenStart(), lexer.getTokenEnd());
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
if (lexer.getTokenType() != JavaTokenType.DOT) break;
|
||||
buffer.append('.');
|
||||
lexer.advance();
|
||||
skipWhiteSpaceAndComments(lexer);
|
||||
}
|
||||
String packageName = buffer.toString();
|
||||
if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.')) return null;
|
||||
return packageName;
|
||||
}
|
||||
|
||||
private static void skipWhiteSpaceAndComments(Lexer lexer){
|
||||
while(JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(lexer.getTokenType())) {
|
||||
lexer.advance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.lang.java;
|
||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -59,7 +60,7 @@ public class JavaCommenter implements CodeDocumentationAwareCommenter {
|
||||
|
||||
@Nullable
|
||||
public IElementType getDocumentationCommentTokenType() {
|
||||
return JavaTokenType.DOC_COMMENT;
|
||||
return JavaDocElementType.DOC_COMMENT;
|
||||
}
|
||||
|
||||
public String getDocumentationCommentPrefix() {
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.java.stubs.JavaStubElementType;
|
||||
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
|
||||
import com.intellij.psi.impl.source.PsiJavaFileImpl;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.IFileElementType;
|
||||
@@ -56,12 +57,12 @@ public class JavaParserDefinition implements ParserDefinition {
|
||||
|
||||
@NotNull
|
||||
public TokenSet getWhitespaceTokens() {
|
||||
return JavaTokenType.WHITESPACE_BIT_SET;
|
||||
return ElementType.JAVA_WHITESPACE_BIT_SET;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TokenSet getCommentTokens() {
|
||||
return JavaTokenType.COMMENT_BIT_SET;
|
||||
return ElementType.JAVA_COMMENT_BIT_SET;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DeclarationParser {
|
||||
|
||||
@Nullable
|
||||
private static PsiBuilder.Marker parseClassFromKeyword(final PsiBuilder builder, final PsiBuilder.Marker declaration,
|
||||
final boolean isAnnotation) {
|
||||
final boolean isAnnotation, final Context context) {
|
||||
final IElementType keywordTokenType = builder.getTokenType();
|
||||
assert ElementType.CLASS_KEYWORD_BIT_SET.contains(keywordTokenType) : keywordTokenType;
|
||||
builder.advanceLexer();
|
||||
@@ -90,6 +90,30 @@ public class DeclarationParser {
|
||||
|
||||
parseClassBodyWithBraces(builder, isAnnotation, isEnum);
|
||||
|
||||
if (context == Context.FILE) {
|
||||
boolean declarationsAfterEnd = false;
|
||||
|
||||
while (builder.getTokenType() != null && builder.getTokenType() != JavaTokenType.RBRACE) {
|
||||
final PsiBuilder.Marker position = builder.mark();
|
||||
final PsiBuilder.Marker extra = parse(builder, Context.CLASS);
|
||||
if (extra != null && AFTER_END_DECLARATION_SET.contains(exprType(extra))) {
|
||||
if (!declarationsAfterEnd) {
|
||||
error(builder, JavaErrorMessages.message("expected.class.or.interface"), extra);
|
||||
}
|
||||
declarationsAfterEnd = true;
|
||||
position.drop();
|
||||
}
|
||||
else {
|
||||
position.rollbackTo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (declarationsAfterEnd) {
|
||||
expectOrError(builder, JavaTokenType.RBRACE, JavaErrorMessages.message("expected.rbrace"));
|
||||
}
|
||||
}
|
||||
|
||||
declaration.done(JavaElementType.CLASS);
|
||||
return declaration;
|
||||
}
|
||||
@@ -220,7 +244,7 @@ public class DeclarationParser {
|
||||
|
||||
if (expect(builder, JavaTokenType.AT)) {
|
||||
if (builder.getTokenType() == JavaTokenType.INTERFACE_KEYWORD) {
|
||||
return parseClassFromKeyword(builder, declaration, true);
|
||||
return parseClassFromKeyword(builder, declaration, true, context);
|
||||
}
|
||||
else {
|
||||
declaration.rollbackTo();
|
||||
@@ -228,32 +252,7 @@ public class DeclarationParser {
|
||||
}
|
||||
}
|
||||
else if (ElementType.CLASS_KEYWORD_BIT_SET.contains(builder.getTokenType())) {
|
||||
final PsiBuilder.Marker root = parseClassFromKeyword(builder, declaration, false);
|
||||
if (context == Context.FILE) {
|
||||
// todo: append following declarations to root (?)
|
||||
boolean declarationsAfterEnd = false;
|
||||
|
||||
while (builder.getTokenType() != null && builder.getTokenType() != JavaTokenType.RBRACE) {
|
||||
final PsiBuilder.Marker position = builder.mark();
|
||||
final PsiBuilder.Marker element = parse(builder, Context.CLASS);
|
||||
if (element != null && AFTER_END_DECLARATION_SET.contains(exprType(element))) {
|
||||
if (!declarationsAfterEnd) {
|
||||
element.precede().error(JavaErrorMessages.message("expected.class.or.interface"));
|
||||
}
|
||||
declarationsAfterEnd = true;
|
||||
position.drop();
|
||||
}
|
||||
else {
|
||||
position.rollbackTo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (declarationsAfterEnd) {
|
||||
expectOrError(builder, JavaTokenType.RBRACE, JavaErrorMessages.message("expected.rbrace"));
|
||||
}
|
||||
}
|
||||
return root;
|
||||
return parseClassFromKeyword(builder, declaration, false, context);
|
||||
}
|
||||
|
||||
PsiBuilder.Marker typeParams = null;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import com.intellij.lang.PsiParser;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.impl.source.parsing.ParseUtil;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -40,6 +41,8 @@ public class JavaParser implements PsiParser {
|
||||
FileParser.parse(builder);
|
||||
root.done(rootType);
|
||||
|
||||
return builder.getTreeBuilt();
|
||||
final ASTNode rootNode = builder.getTreeBuilt();
|
||||
ParseUtil.bindComments(rootNode);
|
||||
return rootNode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.lexer;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaDocTokenType;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
|
||||
@@ -39,11 +40,8 @@ public class JavaHighlightingLexer extends LayeredLexer {
|
||||
|
||||
HtmlHighlightingLexer lexer = new HtmlHighlightingLexer();
|
||||
lexer.setHasNoEmbeddments(true);
|
||||
docLexer.registerLayer(lexer,
|
||||
new IElementType[]{JavaDocTokenType.DOC_COMMENT_DATA});
|
||||
docLexer.registerLayer(lexer, JavaDocTokenType.DOC_COMMENT_DATA);
|
||||
|
||||
registerSelfStoppingLayer(docLexer,
|
||||
new IElementType[]{JavaTokenType.DOC_COMMENT},
|
||||
new IElementType[]{JavaDocTokenType.DOC_COMMENT_END});
|
||||
registerSelfStoppingLayer(docLexer, new IElementType[]{JavaDocElementType.DOC_COMMENT}, IElementType.EMPTY_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import gnu.trove.THashSet;
|
||||
|
||||
@@ -254,7 +255,7 @@ public class JavaLexer extends LexerBase {
|
||||
myTokenEndOffset = getClosingComment(myBufferIndex + 2);
|
||||
}
|
||||
else {
|
||||
myTokenType = JavaTokenType.DOC_COMMENT;
|
||||
myTokenType = JavaDocElementType.DOC_COMMENT;
|
||||
myTokenEndOffset = getDocClosingComment(myBufferIndex + 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package com.intellij.lexer;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
%%
|
||||
@@ -70,7 +71,7 @@ ESCAPE_SEQUENCE=\\[^\r\n]
|
||||
|
||||
<YYINITIAL> {C_STYLE_COMMENT} { return JavaTokenType.C_STYLE_COMMENT; }
|
||||
<YYINITIAL> {END_OF_LINE_COMMENT} { return JavaTokenType.END_OF_LINE_COMMENT; }
|
||||
<YYINITIAL> {DOC_COMMENT} { return JavaTokenType.DOC_COMMENT; }
|
||||
<YYINITIAL> {DOC_COMMENT} { return JavaDocElementType.DOC_COMMENT; }
|
||||
|
||||
<YYINITIAL> {LONG_LITERAL} { return JavaTokenType.LONG_LITERAL; }
|
||||
<YYINITIAL> {INTEGER_LITERAL} { return JavaTokenType.INTEGER_LITERAL; }
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package com.intellij.lexer;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
|
||||
@@ -1049,7 +1050,7 @@ class _JavaLexer implements FlexLexer {
|
||||
}
|
||||
case 116: break;
|
||||
case 55:
|
||||
{ return JavaTokenType.DOC_COMMENT;
|
||||
{ return JavaDocElementType.DOC_COMMENT;
|
||||
}
|
||||
case 117: break;
|
||||
case 64:
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.psi.formatter.common;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.LanguageParserDefinitions;
|
||||
import com.intellij.lang.ParserDefinition;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.jsp.JspElementType;
|
||||
import com.intellij.psi.templateLanguages.OuterLanguageElement;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
|
||||
public class JavaBlockUtil {
|
||||
|
||||
private JavaBlockUtil() {
|
||||
}
|
||||
|
||||
public static boolean mayShiftIndentInside(final ASTNode leaf) {
|
||||
return (isComment(leaf) && !checkJspTexts(leaf))
|
||||
|| leaf.getElementType() == TokenType.WHITE_SPACE
|
||||
|| leaf.getElementType() == XmlElementType.XML_DATA_CHARACTERS
|
||||
|| leaf.getElementType() == JspElementType.JAVA_CODE
|
||||
|| leaf.getElementType() == JspElementType.JSP_SCRIPTLET
|
||||
|| leaf.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN;
|
||||
}
|
||||
|
||||
private static boolean checkJspTexts(final ASTNode leaf) {
|
||||
ASTNode child = leaf.getFirstChildNode();
|
||||
while(child != null){
|
||||
if(child instanceof OuterLanguageElement) return true;
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isComment(final ASTNode node) {
|
||||
final PsiElement psiElement = SourceTreeToPsiMap.treeElementToPsi(node);
|
||||
if (psiElement instanceof PsiComment) return true;
|
||||
final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(psiElement.getLanguage());
|
||||
if (parserDefinition == null) return false;
|
||||
final TokenSet commentTokens = parserDefinition.getCommentTokens();
|
||||
return commentTokens.contains(node.getElementType());
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,10 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.FormatterUtil;
|
||||
import com.intellij.psi.formatter.common.AbstractBlock;
|
||||
import com.intellij.psi.formatter.common.JavaBlockUtil;
|
||||
import com.intellij.psi.formatter.java.wrap.JavaWrapManager;
|
||||
import com.intellij.psi.formatter.java.wrap.ReservedWrapsProvider;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.codeStyle.ShiftIndentInsideHelper;
|
||||
import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.impl.source.tree.java.ClassElement;
|
||||
@@ -1212,7 +1212,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
}
|
||||
|
||||
public boolean isLeaf() {
|
||||
return JavaBlockUtil.mayShiftIndentInside(myNode);
|
||||
return ShiftIndentInsideHelper.mayShiftIndentInside(myNode);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.psi.formatter.java;
|
||||
|
||||
import com.intellij.formatting.*;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.FormatterUtil;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
@@ -72,8 +71,8 @@ public class BlockContainingJavaBlock extends AbstractJavaBlock{
|
||||
// We want to have the comment and method as distinct blocks then in order to correctly process indentation for inner method
|
||||
// elements. See IDEA-53778 for example of situation when it is significant.
|
||||
if (prevChild != null && myNode.getElementType() == ElementType.METHOD
|
||||
&& JavaTokenType.COMMENT_BIT_SET.contains(prevChild.getElementType())
|
||||
&& !JavaTokenType.COMMENT_BIT_SET.contains(child.getElementType()))
|
||||
&& ElementType.JAVA_COMMENT_BIT_SET.contains(prevChild.getElementType())
|
||||
&& !ElementType.JAVA_COMMENT_BIT_SET.contains(child.getElementType()))
|
||||
{
|
||||
prevChild = child;
|
||||
child = composeCodeBlock(result, child, Indent.getNoneIndent(), 0, null);
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.intellij.psi.formatter.java;
|
||||
import com.intellij.formatting.*;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.formatter.common.JavaBlockUtil;
|
||||
import com.intellij.psi.impl.source.codeStyle.ShiftIndentInsideHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -90,7 +90,7 @@ public class LeafBlock implements ASTBlock{
|
||||
}
|
||||
|
||||
public boolean isLeaf() {
|
||||
return JavaBlockUtil.mayShiftIndentInside(myNode);
|
||||
return ShiftIndentInsideHelper.mayShiftIndentInside(myNode);
|
||||
}
|
||||
|
||||
public void setStartOffset(final int startOffset) {
|
||||
|
||||
+2
-2
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.cache.impl.idCache;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
@@ -41,8 +42,7 @@ public class JavaFilterLexer extends BaseFilterLexer {
|
||||
else if (tokenType == JavaTokenType.STRING_LITERAL) {
|
||||
scanWordsInToken(UsageSearchContext.IN_STRINGS | UsageSearchContext.IN_FOREIGN_LANGUAGES, false, true);
|
||||
}
|
||||
else if (tokenType == JavaTokenType.END_OF_LINE_COMMENT || tokenType == JavaTokenType.C_STYLE_COMMENT ||
|
||||
tokenType == JavaTokenType.DOC_COMMENT) {
|
||||
else if (ElementType.JAVA_COMMENT_BIT_SET.contains(tokenType)) {
|
||||
scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false);
|
||||
advanceTodoItemCountsInToken();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
else if (elementType == JavaTokenType.QUEST) {
|
||||
cachedType = createWildcardType();
|
||||
}
|
||||
else if (JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(elementType)) {
|
||||
else if (ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(elementType)) {
|
||||
element = element.getTreeNext();
|
||||
continue;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
|
||||
List<PsiAnnotation> result = null;
|
||||
for (ASTNode child = getFirstChildNode(); child != null; child = child.getTreeNext()) {
|
||||
if (child.getElementType() != JavaElementType.ANNOTATION) continue;
|
||||
ASTNode next = TreeUtil.skipElements(child.getTreeNext(), JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET);
|
||||
ASTNode next = TreeUtil.skipElements(child.getTreeNext(), ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET);
|
||||
if (next != null && next.getElementType() == JavaTokenType.LBRACKET) continue; //annotation on array dimension
|
||||
if (result == null) result = new SmartList<PsiAnnotation>();
|
||||
PsiElement element = child.getPsi();
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.parsing;
|
||||
|
||||
import com.intellij.lang.ASTFactory;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lexer.JavaLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.LexerUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.TokenType;
|
||||
@@ -29,31 +27,13 @@ import com.intellij.psi.impl.source.tree.java.ModifierListElement;
|
||||
import com.intellij.psi.jsp.AbstractJspJavaLexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.SmartList;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ParseUtil {
|
||||
public static TreeElement createTokenElement(Lexer lexer, CharTable table) {
|
||||
IElementType tokenType = lexer.getTokenType();
|
||||
if (tokenType == null) return null;
|
||||
if (tokenType == JavaTokenType.DOC_COMMENT) {
|
||||
return ASTFactory.lazy(JavaDocElementType.DOC_COMMENT, LexerUtil.internToken(lexer, table));
|
||||
}
|
||||
else {
|
||||
return ASTFactory.leaf(tokenType, LexerUtil.internToken(lexer, table));
|
||||
}
|
||||
}
|
||||
|
||||
/*public static void insertMissingTokens(CompositeElement root,
|
||||
Lexer lexer,
|
||||
int startOffset,
|
||||
int endOffset,
|
||||
final int state, TokenProcessor processor, ParsingContext context) {
|
||||
insertMissingTokens(root, lexer, startOffset, endOffset, -1, processor, context);
|
||||
}*/
|
||||
public class ParseUtil extends ParseUtilBase {
|
||||
private ParseUtil() { }
|
||||
|
||||
public static void insertMissingTokens(CompositeElement root,
|
||||
Lexer lexer,
|
||||
@@ -72,6 +52,9 @@ public class ParseUtil {
|
||||
inserter.invoke();
|
||||
}
|
||||
|
||||
public static void bindComments(final ASTNode root) {
|
||||
JavaMissingTokenInserter.bindComments(root);
|
||||
}
|
||||
|
||||
private static class JavaMissingTokenInserter extends MissingTokenInserter {
|
||||
|
||||
@@ -135,7 +118,7 @@ public class ParseUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//pass 2: bind preceding comments (like "// comment \n void f();")
|
||||
// pass 2: bind preceding comments (like "// comment \n void f();")
|
||||
if (!docCommentBound) {
|
||||
for (ASTNode child : comments) {
|
||||
if (child.getElementType() == JavaTokenType.END_OF_LINE_COMMENT || child.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
|
||||
@@ -146,50 +129,13 @@ public class ParseUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private static void bindComments(ASTNode root) {
|
||||
TreeElement child = (TreeElement)root.getFirstChildNode();
|
||||
while (child != null) {
|
||||
if (child.getElementType() == JavaDocElementType.DOC_COMMENT) {
|
||||
if (bindDocComment(child)) {
|
||||
child = child.getTreeParent();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// bind "trailing comments" (like "int a; // comment")
|
||||
if (child.getElementType() == JavaTokenType.END_OF_LINE_COMMENT || child.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
|
||||
if (bindTrailingComment(child)) {
|
||||
child = child.getTreeParent();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bindComments(child);
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
|
||||
//pass 2: bind preceding comments (like "// comment \n void f();")
|
||||
child = (TreeElement)root.getFirstChildNode();
|
||||
while(child != null) {
|
||||
if (child.getElementType() == JavaTokenType.END_OF_LINE_COMMENT || child.getElementType() == JavaTokenType.C_STYLE_COMMENT) {
|
||||
TreeElement next = (TreeElement)TreeUtil.skipElements(child, PRECEDING_COMMENT_OR_SPACE_BIT_SET);
|
||||
bindPrecedingComment(child, next);
|
||||
child = next;
|
||||
} else {
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private static boolean bindDocComment(TreeElement docComment) {
|
||||
TreeElement element = docComment.getTreeNext();
|
||||
if (element == null) return false;
|
||||
TreeElement startSpaces = null;
|
||||
|
||||
TreeElement importList = null;
|
||||
// Bypass meaningless tokens and hold'em in hands
|
||||
// bypass meaningless tokens and hold'em in hands
|
||||
while (element.getElementType() == TokenType.WHITE_SPACE ||
|
||||
element.getElementType() == JavaTokenType.C_STYLE_COMMENT ||
|
||||
element.getElementType() == JavaTokenType.END_OF_LINE_COMMENT ||
|
||||
@@ -263,7 +209,7 @@ public class ParseUtil {
|
||||
TokenType.WHITE_SPACE);
|
||||
|
||||
private static void bindPrecedingComment(TreeElement comment, ASTNode bindTo) {
|
||||
if (bindTo == null || bindTo.getFirstChildNode() != null && bindTo.getFirstChildNode().getElementType() == JavaTokenType.DOC_COMMENT) return;
|
||||
if (bindTo == null || bindTo.getFirstChildNode() != null && bindTo.getFirstChildNode().getElementType() == JavaDocElementType.DOC_COMMENT) return;
|
||||
|
||||
if (bindTo.getElementType() == JavaElementType.IMPORT_LIST && bindTo.getTextLength() == 0) {
|
||||
bindTo = bindTo.getTreeNext();
|
||||
|
||||
@@ -15,22 +15,20 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree;
|
||||
|
||||
import com.intellij.psi.JavaDocTokenType;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiTypeElement;
|
||||
import com.intellij.psi.TokenTypeEx;
|
||||
import com.intellij.psi.impl.source.PsiElementArrayConstructor;
|
||||
import com.intellij.psi.jsp.JspElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
|
||||
public interface ElementType extends
|
||||
TokenTypeEx,
|
||||
JavaElementType,
|
||||
JavaDocElementType {
|
||||
public interface ElementType extends JavaTokenType, JavaDocTokenType,
|
||||
JavaElementType, JavaDocElementType {
|
||||
TokenSet WHITE_SPACE_BIT_SET = TokenSet.create(WHITE_SPACE,
|
||||
JspElementType.JSP_TEMPLATE_EXPRESSION);
|
||||
|
||||
TokenSet JAVA_WHITESPACE_BIT_SET = TokenSet.create(WHITE_SPACE);
|
||||
TokenSet JAVA_COMMENT_BIT_SET = TokenSet.create(END_OF_LINE_COMMENT, C_STYLE_COMMENT, JavaTokenType.DOC_COMMENT, JavaDocElementType.DOC_COMMENT);
|
||||
TokenSet JAVA_COMMENT_BIT_SET = TokenSet.create(END_OF_LINE_COMMENT, C_STYLE_COMMENT, JavaDocElementType.DOC_COMMENT);
|
||||
|
||||
TokenSet JAVA_COMMENT_OR_WHITESPACE_BIT_SET = TokenSet.orSet(JAVA_WHITESPACE_BIT_SET, JAVA_COMMENT_BIT_SET);
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
|
||||
import com.intellij.psi.impl.source.JavaFileElementType;
|
||||
import com.intellij.psi.impl.source.parsing.JavaParsingContext;
|
||||
import com.intellij.psi.impl.source.parsing.Parsing;
|
||||
import com.intellij.psi.impl.source.tree.java.PsiCodeBlockImpl;
|
||||
import com.intellij.psi.text.BlockSupport;
|
||||
import com.intellij.psi.tree.*;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.IErrorCounterReparseableElementType;
|
||||
import com.intellij.psi.tree.ILazyParseableElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
@@ -119,8 +121,6 @@ public interface JavaElementType {
|
||||
IElementType ANNOTATION_PARAMETER_LIST = new IJavaElementType("ANNOTATION_PARAMETER_LIST", true);
|
||||
IElementType METHOD_RECEIVER = new IJavaElementType("METHOD_RECEIVER");
|
||||
|
||||
IElementType INSTANT_CODE_BLOCK = new IJavaElementType("CODE_BLOCK");
|
||||
|
||||
ILazyParseableElementType CODE_BLOCK = new IErrorCounterReparseableElementType("CODE_BLOCK", StdLanguages.JAVA) {
|
||||
@Override
|
||||
public ASTNode createNode(CharSequence text) {
|
||||
|
||||
@@ -50,7 +50,6 @@ public class JavaSharedImplUtil {
|
||||
else if (i != JavaTokenType.RBRACKET && i != TokenType.WHITE_SPACE &&
|
||||
i != JavaTokenType.C_STYLE_COMMENT &&
|
||||
i != JavaDocElementType.DOC_COMMENT &&
|
||||
i != JavaTokenType.DOC_COMMENT &&
|
||||
i != JavaTokenType.END_OF_LINE_COMMENT) {
|
||||
break;
|
||||
}
|
||||
@@ -79,7 +78,6 @@ public class JavaSharedImplUtil {
|
||||
else if (i != JavaTokenType.RBRACKET && i != TokenType.WHITE_SPACE &&
|
||||
i != JavaTokenType.C_STYLE_COMMENT &&
|
||||
i != JavaDocElementType.DOC_COMMENT &&
|
||||
i != JavaTokenType.DOC_COMMENT &&
|
||||
i != JavaTokenType.END_OF_LINE_COMMENT) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.tree;
|
||||
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.jsp.JspElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
@@ -24,6 +23,9 @@ import com.intellij.psi.xml.XmlElementType;
|
||||
* @author mike
|
||||
*/
|
||||
public interface StdTokenSets {
|
||||
TokenSet COMMENT_BIT_SET = TokenSet.orSet(ElementType.JAVA_COMMENT_BIT_SET, TokenSet.create(JspElementType.JSP_COMMENT, XmlElementType.XML_COMMENT));
|
||||
TokenSet WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.orSet(ElementType.WHITE_SPACE_BIT_SET, JavaTokenType.COMMENT_BIT_SET);
|
||||
TokenSet COMMENT_BIT_SET = TokenSet.orSet(
|
||||
ElementType.JAVA_COMMENT_BIT_SET, TokenSet.create(JspElementType.JSP_COMMENT, XmlElementType.XML_COMMENT));
|
||||
|
||||
TokenSet WHITE_SPACE_OR_COMMENT_BIT_SET = TokenSet.orSet(
|
||||
ElementType.WHITE_SPACE_BIT_SET, ElementType.JAVA_COMMENT_BIT_SET);
|
||||
}
|
||||
|
||||
@@ -51,8 +51,7 @@ public class ClassElement extends CompositeElement implements Constants {
|
||||
public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) {
|
||||
PsiClass psiClass = (PsiClass)SourceTreeToPsiMap.treeElementToPsi(this);
|
||||
if (anchor == null) {
|
||||
if (first.getElementType() != JavaDocElementType.DOC_COMMENT &&
|
||||
first.getElementType() != JavaTokenType.DOC_COMMENT) {
|
||||
if (first.getElementType() != JavaDocElementType.DOC_COMMENT) {
|
||||
if (before == null) {
|
||||
if (first == last) {
|
||||
PsiElement firstPsi = SourceTreeToPsiMap.treeElementToPsi(first);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EnumConstantElement extends CompositeElement implements Constants {
|
||||
public int getChildRole(ASTNode child) {
|
||||
LOG.assertTrue(child.getTreeParent() == this);
|
||||
IElementType i = child.getElementType();
|
||||
if (i == JavaTokenType.DOC_COMMENT || i == JavaDocElementType.DOC_COMMENT) {
|
||||
if (i == JavaDocElementType.DOC_COMMENT) {
|
||||
return getChildRole(child, ChildRole.DOC_COMMENT);
|
||||
}
|
||||
else if (i == JavaTokenType.C_STYLE_COMMENT || i == JavaTokenType.END_OF_LINE_COMMENT) {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class FieldElement extends CompositeElement{
|
||||
public int getChildRole(ASTNode child) {
|
||||
assert (child.getTreeParent() == this);
|
||||
IElementType i = child.getElementType();
|
||||
if (i == JavaTokenType.DOC_COMMENT || i == JavaDocElementType.DOC_COMMENT) {
|
||||
if (i == JavaDocElementType.DOC_COMMENT) {
|
||||
return getChildRole(child, ChildRole.DOC_COMMENT);
|
||||
}
|
||||
else if (i == JavaTokenType.C_STYLE_COMMENT || i == JavaTokenType.END_OF_LINE_COMMENT) {
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.source.tree.java;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.TokenType;
|
||||
@@ -115,7 +114,7 @@ public class MethodElement extends CompositeElement implements Constants {
|
||||
public int getChildRole(ASTNode child) {
|
||||
LOG.assertTrue(child.getTreeParent() == this);
|
||||
IElementType i = child.getElementType();
|
||||
if (i == JavaTokenType.DOC_COMMENT || i == JavaDocElementType.DOC_COMMENT) {
|
||||
if (i == JavaDocElementType.DOC_COMMENT) {
|
||||
return getChildRole(child, ChildRole.DOC_COMMENT);
|
||||
}
|
||||
else if (i == C_STYLE_COMMENT || i == END_OF_LINE_COMMENT) {
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ public class PsiDeclarationStatementImpl extends CompositePsiElement implements
|
||||
ASTNode prev = child;
|
||||
do {
|
||||
prev = prev.getTreePrev();
|
||||
} while (prev != null && JavaTokenType.WHITE_SPACE_OR_COMMENT_BIT_SET.contains(prev.getElementType()));
|
||||
} while (prev != null && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(prev.getElementType()));
|
||||
if (prev != null && prev.getElementType() == JavaTokenType.COMMA) deleteChildInternal(prev);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class PsiExpressionListImpl extends CompositePsiElement implements PsiExp
|
||||
for (ASTNode child = element.getTreePrev(); child != null; child = child.getTreePrev()) {
|
||||
final IElementType t = child.getElementType();
|
||||
if (t == JavaTokenType.COMMA) break;
|
||||
if (ElementType.EXPRESSION_BIT_SET.contains(t) || ElementType.COMMENT_BIT_SET.contains(t)) {
|
||||
if (ElementType.EXPRESSION_BIT_SET.contains(t) || ElementType.JAVA_COMMENT_BIT_SET.contains(t)) {
|
||||
TreeElement comma = Factory.createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, treeCharTab, getManager());
|
||||
super.addInternal(comma, comma, child, Boolean.FALSE);
|
||||
break;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
@Endorsers({"Children", "Unscrupulous dentisits"}) public class Lollilop {}
|
||||
@@ -0,0 +1,39 @@
|
||||
PsiJavaFile:Array.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Lollilop
|
||||
PsiModifierList:@Endorsers({"Children", "Unscrupulous dentisits"}) public
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Endorsers
|
||||
PsiIdentifier:Endorsers('Endorsers')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiArrayInitializerMemberValue:{"Children", "Unscrupulous dentisits"}
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiLiteralExpression:"Children"
|
||||
PsiJavaToken:STRING_LITERAL('"Children"')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiLiteralExpression:"Unscrupulous dentisits"
|
||||
PsiJavaToken:STRING_LITERAL('"Unscrupulous dentisits"')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Lollilop('Lollilop')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,3 @@
|
||||
class Fantasy {
|
||||
@Author(first="Eugene", second="Wampirchik") void compose () {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
PsiJavaFile:Complex.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Fantasy
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Fantasy('Fantasy')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:compose
|
||||
PsiModifierList:@Author(first="Eugene", second="Wampirchik")
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Author
|
||||
PsiIdentifier:Author('Author')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:first('first')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiLiteralExpression:"Eugene"
|
||||
PsiJavaToken:STRING_LITERAL('"Eugene"')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:second('second')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiLiteralExpression:"Wampirchik"
|
||||
PsiJavaToken:STRING_LITERAL('"Wampirchik"')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:compose('compose')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace(' \n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
@Preliminary(A.B
|
||||
#) public class TimeTravel {}
|
||||
|
||||
@Preliminary(a=A.B
|
||||
#) public class TimeTravel {}
|
||||
|
||||
@Preliminary(a=A.B
|
||||
#, b=c) public class TimeTravel {}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
PsiJavaFile:EnumSmartTypeCompletion.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:@Preliminary(A.B
|
||||
#) public
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Preliminary
|
||||
PsiIdentifier:Preliminary('Preliminary')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiReferenceExpression:A.B
|
||||
PsiReferenceExpression:A
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:B('B')
|
||||
PsiErrorElement:',' or ')' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(BAD_CHARACTER)('#')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:@Preliminary(a=A.B
|
||||
#) public
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Preliminary
|
||||
PsiIdentifier:Preliminary('Preliminary')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:a('a')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiReferenceExpression:A.B
|
||||
PsiReferenceExpression:A
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:B('B')
|
||||
PsiErrorElement:',' or ')' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(BAD_CHARACTER)('#')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:@Preliminary(a=A.B
|
||||
#, b=c) public
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Preliminary
|
||||
PsiIdentifier:Preliminary('Preliminary')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:a('a')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiReferenceExpression:A.B
|
||||
PsiReferenceExpression:A
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:A('A')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:B('B')
|
||||
PsiErrorElement:',' or ')' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(BAD_CHARACTER)('#')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:b('b')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiReferenceExpression:c
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:c('c')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1 @@
|
||||
@Preliminary public class TimeTravel {}
|
||||
@@ -0,0 +1,28 @@
|
||||
PsiJavaFile:Marker.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:@Preliminary public
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Preliminary
|
||||
PsiIdentifier:Preliminary('Preliminary')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1 @@
|
||||
@Preliminary public @Other(name=value) class TimeTravel {}
|
||||
@@ -0,0 +1,45 @@
|
||||
PsiJavaFile:Multiple.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:@Preliminary public @Other(name=value)
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Preliminary
|
||||
PsiIdentifier:Preliminary('Preliminary')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Other
|
||||
PsiIdentifier:Other('Other')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:name('name')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiReferenceExpression:value
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:value('value')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,3 @@
|
||||
class Fantasy {
|
||||
@Author(@Name(first="Eugene", second="Wampirchik")) void compose () {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
PsiJavaFile:Nested.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Fantasy
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Fantasy('Fantasy')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:compose
|
||||
PsiModifierList:@Author(@Name(first="Eugene", second="Wampirchik"))
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Author
|
||||
PsiIdentifier:Author('Author')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Name
|
||||
PsiIdentifier:Name('Name')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:first('first')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiLiteralExpression:"Eugene"
|
||||
PsiJavaToken:STRING_LITERAL('"Eugene"')
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:second('second')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiLiteralExpression:"Wampirchik"
|
||||
PsiJavaToken:STRING_LITERAL('"Wampirchik"')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:compose('compose')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace(' \n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+1
@@ -0,0 +1 @@
|
||||
@Annotation package P;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
PsiJavaFile:PackageAnnotation.java
|
||||
PsiPackageStatement:P
|
||||
PsiModifierList:@Annotation
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Annotation
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:package('package')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:P
|
||||
PsiIdentifier:P('P')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiImportList
|
||||
<empty list>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
public class Annotated {
|
||||
void foo (@Annotation(value=77) int param) {
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
PsiJavaFile:ParameterAnnotation.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Annotated
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotated('Annotated')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:foo
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:(@Annotation(value=77) int param)
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiParameter:param
|
||||
PsiModifierList:@Annotation(value=77)
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Annotation
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiIdentifier:value('value')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiLiteralExpression:77
|
||||
PsiJavaToken:INTEGER_LITERAL('77')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:param('param')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Tester {
|
||||
@Nullable <T> T bar() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
PsiJavaFile:ParameterizedMethod.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Tester
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Tester('Tester')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:bar
|
||||
PsiModifierList:@Nullable
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Nullable
|
||||
PsiIdentifier:Nullable('Nullable')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeParameter:T
|
||||
PsiIdentifier:T('T')
|
||||
PsiElement(EXTENDS_BOUND_LIST)
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:T
|
||||
PsiJavaCodeReferenceElement:T
|
||||
PsiIdentifier:T('T')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:bar('bar')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiReturnStatement
|
||||
PsiKeyword:return('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiLiteralExpression:null
|
||||
PsiJavaToken:NULL_KEYWORD('null')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
interface PsiElement {
|
||||
@org.jetbrains.annotations.Nullable <T> T getCopyableUserData(Key<T> key);
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
PsiJavaFile:QualifiedAnnotation.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:PsiElement
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:PsiElement('PsiElement')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:getCopyableUserData
|
||||
PsiModifierList:@org.jetbrains.annotations.Nullable
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:org.jetbrains.annotations.Nullable
|
||||
PsiJavaCodeReferenceElement:org.jetbrains.annotations
|
||||
PsiJavaCodeReferenceElement:org.jetbrains
|
||||
PsiJavaCodeReferenceElement:org
|
||||
PsiIdentifier:org('org')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:jetbrains('jetbrains')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:annotations('annotations')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:Nullable('Nullable')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeParameter:T
|
||||
PsiIdentifier:T('T')
|
||||
PsiElement(EXTENDS_BOUND_LIST)
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:T
|
||||
PsiJavaCodeReferenceElement:T
|
||||
PsiIdentifier:T('T')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:getCopyableUserData('getCopyableUserData')
|
||||
PsiParameterList:(Key<T> key)
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiParameter:key
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeElement:Key<T>
|
||||
PsiJavaCodeReferenceElement:Key<T>
|
||||
PsiIdentifier:Key('Key')
|
||||
PsiReferenceParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeElement:T
|
||||
PsiJavaCodeReferenceElement:T
|
||||
PsiIdentifier:T('T')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:key('key')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1 @@
|
||||
public @Copyright("bla-bla-bla") class TimeTravel {}
|
||||
@@ -0,0 +1,32 @@
|
||||
PsiJavaFile:Simple.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:public @Copyright("bla-bla-bla")
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Copyright
|
||||
PsiIdentifier:Copyright('Copyright')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiLiteralExpression:"bla-bla-bla"
|
||||
PsiJavaToken:STRING_LITERAL('"bla-bla-bla"')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1 @@
|
||||
public @Copyright(treatedAsValue) class TimeTravel {}
|
||||
@@ -0,0 +1,34 @@
|
||||
PsiJavaFile:Simple2.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:TimeTravel
|
||||
PsiModifierList:public @Copyright(treatedAsValue)
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Copyright
|
||||
PsiIdentifier:Copyright('Copyright')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiNameValuePair
|
||||
PsiReferenceExpression:treatedAsValue
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:treatedAsValue('treatedAsValue')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:TimeTravel('TimeTravel')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,9 @@
|
||||
class C<@D T extends @F Object> extends @F Object {
|
||||
@F int @F[] methodf() @F throws @F Exception {
|
||||
a = this instanceof @F C;
|
||||
C<@F @G C> c = new @Q C<@F C>();
|
||||
c = (@F Object)c;
|
||||
Class c = @TA String.class;
|
||||
@F C.field++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
PsiJavaFile:TypeAnno.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:C
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:C('C')
|
||||
PsiTypeParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeParameter:T
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:D
|
||||
PsiIdentifier:D('D')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:T('T')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EXTENDS_BOUND_LIST)
|
||||
PsiKeyword:extends('extends')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:@F Object
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Object('Object')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiReferenceList
|
||||
PsiKeyword:extends('extends')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:@F Object
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Object('Object')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:methodf
|
||||
PsiModifierList:@F
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:int @F[]
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:LBRACKET('[')
|
||||
PsiJavaToken:RBRACKET(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:methodf('methodf')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(METHOD_RECEIVER)
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiReferenceList
|
||||
PsiKeyword:throws('throws')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:@F Exception
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Exception('Exception')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiExpressionStatement
|
||||
PsiAssignmentExpression:a = this instanceof @F C
|
||||
PsiReferenceExpression:a
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:a('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiInstanceofExpression:this instanceof @F C
|
||||
PsiThisExpression:this
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiKeyword:this('this')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:instanceof('instanceof')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeElement:@F C
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:C
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiDeclarationStatement
|
||||
PsiLocalVariable:c
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeElement:C<@F @G C>
|
||||
PsiJavaCodeReferenceElement:C<@F @G C>
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeElement:@F @G C
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:G
|
||||
PsiIdentifier:G('G')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:C
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:c('c')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiNewExpression:new @Q C<@F C>()
|
||||
PsiKeyword:new('new')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:@Q C<@F C>
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:Q
|
||||
PsiIdentifier:Q('Q')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
PsiJavaToken:LT('<')
|
||||
PsiTypeElement:@F C
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:C
|
||||
PsiIdentifier:C('C')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:GT('>')
|
||||
PsiExpressionList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiExpressionStatement
|
||||
PsiAssignmentExpression:c = (@F Object)c
|
||||
PsiReferenceExpression:c
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:c('c')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiTypeCastExpression:(@F Object)c
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiTypeElement:@F Object
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:Object
|
||||
PsiIdentifier:Object('Object')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceExpression:c
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:c('c')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiDeclarationStatement
|
||||
PsiLocalVariable:c
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeElement:Class
|
||||
PsiJavaCodeReferenceElement:Class
|
||||
PsiIdentifier:Class('Class')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:c('c')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:EQ('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiClassObjectAccessExpression:@TA String.class
|
||||
PsiTypeElement:@TA String
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:TA
|
||||
PsiIdentifier:TA('TA')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiKeyword:class('class')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiExpressionStatement
|
||||
PsiPostfixExpression:@F C.field++
|
||||
PsiReferenceExpression:@F C.field
|
||||
PsiReferenceExpression:@F C
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:F
|
||||
PsiIdentifier:F('F')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:C('C')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:field('field')
|
||||
PsiJavaToken:PLUSPLUS('++')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,3 @@
|
||||
@interface Annotation {
|
||||
Class foo () default String.class;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
PsiJavaFile:Default.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Annotation
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:foo
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:Class
|
||||
PsiJavaCodeReferenceElement:Class
|
||||
PsiIdentifier:Class('Class')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:default('default')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiClassObjectAccessExpression:String.class
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiKeyword:class('class')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
class Annotation {
|
||||
@interface Inner {
|
||||
double bar () default 0.0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
PsiJavaFile:Inner.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Annotation
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiClass:Inner
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Inner('Inner')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:bar
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:double
|
||||
PsiKeyword:double('double')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:bar('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:default('default')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiLiteralExpression:0.0
|
||||
PsiJavaToken:DOUBLE_LITERAL('0.0')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,7 @@
|
||||
@interface Annotation {
|
||||
Class foo () default String.class;
|
||||
|
||||
@interface Inner {
|
||||
String bar () default "<unspecified>";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
PsiJavaFile:Nested.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Annotation
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:foo
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:Class
|
||||
PsiJavaCodeReferenceElement:Class
|
||||
PsiIdentifier:Class('Class')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:default('default')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiClassObjectAccessExpression:String.class
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiKeyword:class('class')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiClass:Inner
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Inner('Inner')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:bar
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:bar('bar')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:default('default')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiLiteralExpression:"<unspecified>"
|
||||
PsiJavaToken:STRING_LITERAL('"<unspecified>"')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@interface Annotation {
|
||||
Class foo () default String.class;
|
||||
int field;
|
||||
void m() {}
|
||||
class C {}
|
||||
interface I {}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
PsiJavaFile:OtherMembers.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Annotation
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:foo
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:Class
|
||||
PsiJavaCodeReferenceElement:Class
|
||||
PsiIdentifier:Class('Class')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:default('default')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiClassObjectAccessExpression:String.class
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiKeyword:class('class')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiField:field
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:field('field')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:m
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:m('m')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiClass:C
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:C('C')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiClass:I
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:I('I')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
import java.util.*;
|
||||
|
||||
public @interface Annotation {
|
||||
int foo ();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
PsiJavaFile:Simple.java
|
||||
PsiImportList
|
||||
PsiImportStatement
|
||||
PsiKeyword:import('import')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaCodeReferenceElement:java.util
|
||||
PsiJavaCodeReferenceElement:java
|
||||
PsiIdentifier:java('java')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiIdentifier:util('util')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiJavaToken:ASTERISK('*')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiClass:Annotation
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:AT('@')
|
||||
PsiKeyword:interface('interface')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Annotation('Annotation')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiAnnotationMethod:foo
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,2 @@
|
||||
/**//******/class AClass{
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
PsiJavaFile:ImportListBug.java
|
||||
PsiDocComment
|
||||
PsiDocToken:DOC_COMMENT_END('/**/')
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:AClass
|
||||
PsiDocComment
|
||||
PsiDocToken:DOC_COMMENT_START('/**')
|
||||
PsiDocToken:DOC_COMMENT_END('****/')
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:AClass('AClass')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void method() {
|
||||
<identifier
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
PsiJavaFile:IncompleteCodeBlock.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:A
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:A('A')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiMethod:method
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:method('method')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiJavaToken:LT('<')
|
||||
PsiExpressionStatement
|
||||
PsiReferenceExpression:identifier
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:identifier('identifier')
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,6 @@
|
||||
class FreezeTest {
|
||||
void test() {
|
||||
String.class.
|
||||
String[] strings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
PsiJavaFile:SCR5202.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:FreezeTest
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:FreezeTest('FreezeTest')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n\t')
|
||||
PsiMethod:test
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiTypeElement:void
|
||||
PsiKeyword:void('void')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:test('test')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiCodeBlock
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n\t\t')
|
||||
PsiExpressionStatement
|
||||
PsiReferenceExpression:String.class.
|
||||
String
|
||||
PsiClassObjectAccessExpression:String.class
|
||||
PsiTypeElement:String
|
||||
PsiJavaCodeReferenceElement:String
|
||||
PsiIdentifier:String('String')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiKeyword:class('class')
|
||||
PsiJavaToken:DOT('.')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n\t\t')
|
||||
PsiIdentifier:String('String')
|
||||
PsiErrorElement:';' expected
|
||||
<empty list>
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiJavaToken:LBRACKET('[')
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiJavaToken:RBRACKET(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiExpressionStatement
|
||||
PsiReferenceExpression:strings
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiIdentifier:strings('strings')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n\t')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
*/
|
||||
public abstract class Test {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
PsiJavaFile:EmptyImportList.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:Test
|
||||
PsiDocComment
|
||||
PsiDocToken:DOC_COMMENT_START('/**')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiDocToken:DOC_COMMENT_END('*/')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiModifierList:public abstract
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:abstract('abstract')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:class('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:Test('Test')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,2 @@
|
||||
public enum OurEnum {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
PsiJavaFile:Enum1.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -0,0 +1,2 @@
|
||||
enum OurEnum {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
PsiJavaFile:Enum2.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
enum OurEnum {
|
||||
@ANNOTATION A(10)
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
PsiJavaFile:EnumWithAnnotatedConstants.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiEnumConstant:A
|
||||
PsiModifierList:@ANNOTATION
|
||||
PsiAnnotation
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaCodeReferenceElement:ANNOTATION
|
||||
PsiIdentifier:ANNOTATION('ANNOTATION')
|
||||
PsiReferenceParameterList
|
||||
<empty list>
|
||||
PsiAnnotationParameterList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:A('A')
|
||||
PsiExpressionList
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiLiteralExpression:10
|
||||
PsiJavaToken:INTEGER_LITERAL('10')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public enum OurEnum {
|
||||
;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
PsiJavaFile:EnumWithConstants1.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public enum OurEnum {
|
||||
RED, GREEN, BLUE;
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
PsiJavaFile:EnumWithConstants2.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiEnumConstant:RED
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:RED('RED')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:GREEN
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:GREEN('GREEN')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:BLUE
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:BLUE('BLUE')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public enum OurEnum {
|
||||
RED, GREEN, BLUE
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
PsiJavaFile:EnumWithConstants3.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiEnumConstant:RED
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:RED('RED')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:GREEN
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:GREEN('GREEN')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:BLUE
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:BLUE('BLUE')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public enum OurEnum {
|
||||
RED, GREEN, BLUE,
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
PsiJavaFile:EnumWithConstants4.java
|
||||
PsiImportList
|
||||
<empty list>
|
||||
PsiClass:OurEnum
|
||||
PsiModifierList:public
|
||||
PsiKeyword:public('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiKeyword:enum('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:OurEnum('OurEnum')
|
||||
PsiTypeParameterList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiReferenceList
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiEnumConstant:RED
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:RED('RED')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:GREEN
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:GREEN('GREEN')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiEnumConstant:BLUE
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiIdentifier:BLUE('BLUE')
|
||||
PsiExpressionList
|
||||
<empty list>
|
||||
PsiJavaToken:COMMA(',')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user