moved to community

This commit is contained in:
Alexey Kudravtsev
2015-11-16 13:31:16 +03:00
parent 17de17c766
commit 70290391f9
23 changed files with 31185 additions and 2 deletions

View File

@@ -39,7 +39,6 @@
<orderEntry type="module" module-name="java-indexing-api" scope="TEST" />
<orderEntry type="module" module-name="external-system-impl" scope="RUNTIME" />
<orderEntry type="module" module-name="junit_rt" scope="TEST" />
<orderEntry type="module" module-name="xml-psi-impl" scope="TEST" />
<orderEntry type="module" module-name="properties-psi-api" scope="TEST" />
<orderEntry type="module" module-name="java-decompiler-plugin" scope="TEST" />
<orderEntry type="module" module-name="RegExpSupport" scope="TEST" />
@@ -50,5 +49,7 @@
<orderEntry type="module" module-name="lang-tests" scope="TEST" />
<orderEntry type="library" scope="TEST" name="mockito" level="project" />
<orderEntry type="library" scope="TEST" name="assertJ" level="project" />
<orderEntry type="module" module-name="xml-analysis-impl" />
<orderEntry type="module" module-name="xml-psi-impl" />
</component>
</module>

View File

@@ -0,0 +1,3 @@
class AClass<caret> {
}

View File

@@ -0,0 +1,10 @@
class Foo {
@SuppressWarnings({"FieldCanBeLocal"})
private final String text;
public Foo(String text) {
this.text = text;
}
public void doSomething(int i) {
System.out.println(i+<caret>i);
}
}

View File

@@ -0,0 +1,5 @@
class E {
void fff() {
int i = <caret>
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:book xmlns:xs="http://myschema/" isbn="1234">
<title2>Alice in Wonderland
</title2>
<author>C S Lewis</author>
<character>
<name>Alice</name>
</character>
</xs:book>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myschema/"
elementFormDefault="unqualified">
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="<caret>title2" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="character" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="friend-of" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="since" type="xsd:date"/>
<xsd:element name="qualification" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="isbn" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<description>rtetre tretre</description>
<display-name>rrr aksjdb sadkj fgrrretyr re tre tre tre t</display-name>
<jsp-config>
<jsp-property-group>
<description>
<caret><!--<ddd/>-->
</description>
<dddddddddd/>
</jsp-property-group>
</jsp-config>
</web-app>

View File

@@ -0,0 +1,5 @@
class AClass {
{
toString(0,<caret>0);
}
}

View File

@@ -0,0 +1,9 @@
class SSSSS {
public static void suite() {
<caret>
new Runnable() {
public void run() {
}
};
}

View File

@@ -0,0 +1,29 @@
class abcd
{
private static void throwException(Object obj)
{
new NullPointerException("NPE");
throw (obj == null) ? new NullPointerException("NPE")
: new RuntimeException("RTE");
}
public static void main(String[] args) throws Exception
{
try
{
throwException(null);
}
catch (Throwable t)
{
t.printStackTrace();
}
try
{
throwException(new Object());
}
catch (Throwable t)
{
t.printStackTrace();
}<caret>
}
}

View File

@@ -0,0 +1,13 @@
class C3 {
@SuppressWarnings({"UnusedDeclaration"})
private int xxxx;
public C3(int xxxx) {
this.xxxx = xxxx;
}
void f(int i) {
int x = <caret>0;
f(x+i);
}
}

View File

@@ -0,0 +1,8 @@
class Test
{
{
String s = new String(
<caret>1);
}
}

View File

@@ -0,0 +1,61 @@
import java.util.concurrent.Callable;
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: May 19, 2009
* Time: 2:59:31 PM
* To change this template use File | Settings | File Templates.
*/
class LineMarkers implements Runnable, Callable, CharSequence{
<caret>
public void run() {
//To change body of implemented methods use File | Settings | File Templates.
}
public Object call() throws Exception {
return this;
}
public int length() {
return 0; //To change body of implemented methods use File | Settings | File Templates.
}
public char charAt(int index) {
return 0; //To change body of implemented methods use File | Settings | File Templates.
}
public CharSequence subSequence(int start, int end) {
return toString();
}
}

View File

@@ -0,0 +1,13 @@
class XXXXX {
void f() {
}
void gg() {
<caret>
}
}
class Y extends XXXXX {
void f() {
}
}

View File

@@ -0,0 +1,43 @@
import java.io.*;
class Test {
float y;
void f() {
int x = 11;
System.out.println("aap");
if (Math.random() > 0.5) {
for (int j = 0; j < 10; j++) {
System.out.println(x);
}
}
try {
g(0);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
try {
g(0);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
void foo() {
try {
g(0);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
/**
*
* @param u
*/
private void g(int u) {
int x = 12;
System.out.println("foo");
System.out.println("bar");
System.out.println(x);
}
}

View File

@@ -0,0 +1,10 @@
class Ds {
public int meth(int j) {
int <caret>e = j;
int d = e;
if (j==0) {
int e = j;
}
return 0;
}
}

View File

@@ -0,0 +1,7 @@
class Unused {
private int ffff;
void foo(int p) {
if (p==0) return;
<caret>
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.resolve;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.ResolveCache;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.testFramework.ResolveTestCase;
import com.intellij.util.containers.ContainerUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: ik
* Date: 27.08.2003
* Time: 19:09:43
* To change this template use Options | File Templates.
*/
public class ResolvePerformanceTest extends ResolveTestCase {
public void testPerformance1() throws Exception{
final String fullPath = PathManagerEx.getTestDataPath() + "/psi/resolve/Thinlet.java";
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
final List<PsiReference> references = new ArrayList<PsiReference>();
assertNotNull("file " + fullPath + " not found", vFile);
//final int[] ints = new int[10000000];
System.gc();
String fileText = StringUtil.convertLineSeparators(VfsUtil.loadText(vFile));
myFile = createFile(vFile.getName(), fileText);
myFile.accept(new JavaRecursiveElementWalkingVisitor(){
@Override public void visitReferenceExpression(PsiReferenceExpression expression){
references.add(expression);
visitElement(expression);
}
});
System.out.println();
System.out.println("Found " + references.size() + " references");
long time = System.currentTimeMillis();
// Not cached pass
resolveAllReferences(references);
System.out.println("Not cached resolve: " + (System.currentTimeMillis() - time)/(double)1000 + "s");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ResolveCache.getInstance(myProject).clearCache(true);
}
});
time = System.currentTimeMillis();
// Cached pass
resolveAllReferences(references);
System.out.println("Not cached resolve with cached repository: " + (System.currentTimeMillis() - time)/(double)1000 + "s");
time = System.currentTimeMillis();
// Cached pass
resolveAllReferences(references);
System.out.println("Cached resolve: " + (System.currentTimeMillis() - time)/(double)1000 + "s");
}
public void testPerformance2() throws Exception{
final String fullPath = PathManagerEx.getTestDataPath() + "/psi/resolve/ant/build.xml";
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(fullPath.replace(File.separatorChar, '/'));
final List<PsiReference> references = new ArrayList<PsiReference>();
assertNotNull("file " + fullPath + " not found", vFile);
String fileText = VfsUtil.loadText(vFile);
fileText = StringUtil.convertLineSeparators(fileText);
myFile = createFile(vFile.getName(), fileText);
myFile.accept(new XmlRecursiveElementVisitor(){
@Override public void visitXmlAttributeValue(XmlAttributeValue value) {
ContainerUtil.addAll(references, value.getReferences());
super.visitXmlAttributeValue(value);
}
});
myFile.accept(new JavaRecursiveElementWalkingVisitor() {
@Override public void visitReferenceExpression(PsiReferenceExpression expression){
references.add(expression);
visitElement(expression);
}
});
System.out.println();
System.out.println("Found " + references.size() + " references");
resolveAllReferences(references);
}
private static void resolveAllReferences(List<PsiReference> list){
for (PsiReference reference : list) {
if (reference instanceof PsiJavaReference) {
((PsiJavaReference)reference).advancedResolve(false).isValidResult();
}
else {
reference.resolve();
}
}
}
}

View File

@@ -56,7 +56,7 @@ import java.util.*;
storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml")}
)
public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx implements PersistentStateComponent<Element> {
static final Logger LOG = Logger.getInstance(ExternalResourceManagerExImpl.class);
private static final Logger LOG = Logger.getInstance(ExternalResourceManagerExImpl.class);
@NonNls public static final String J2EE_1_3 = "http://java.sun.com/dtd/";
@NonNls public static final String J2EE_1_2 = "http://java.sun.com/j2ee/dtds/";