copyright in testdata

This commit is contained in:
Maxim.Medvedev
2012-05-16 12:20:46 +04:00
parent 861efe85ad
commit 764a7bd65c
20 changed files with 38 additions and 301 deletions

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Add Method Body" "true"
class a {
void f() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Add Method Body" "true"
class a {
String f() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Add Method Body" "true"
class a {
a() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Add Method Body" "true"
class a {
String f() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Constructor" "true"
class Test {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'test'" "true"
public class Test {
static void test(int i) {}

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'bar'" "true"
public class Test {
<T extends String> void foo (T t1, T t2) {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'test'" "true"
public class Test {
public Test() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'bar'" "true"
class A {
public void foo() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'someMethod'" "true"
public class Test {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'f'" "true"
class A {
{

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'f'" "true"
public class A {
public A() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'get'" "true"
class Generic<T> {
public T get() {

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'foo'" "true"
interface Int<T> {
}

View File

@@ -1,19 +1,3 @@
/*
* Copyright 2000-2012 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.
*/
// "Create Method 'foo'" "true"
interface Comparable<T> {
}

View File

@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.PsiElement;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
@@ -36,8 +37,13 @@ class AlignmentProvider {
private final Map<PsiElement, Set<PsiElement>> myTree = new HashMap<PsiElement, Set<PsiElement>>();
private final Map<Set<PsiElement>, Alignment> myAlignments = new HashMap<Set<PsiElement>, Alignment>();
private final Map<Set<PsiElement>, Boolean> myAllowBackwardShift = new HashMap<Set<PsiElement>, Boolean>();
private final Map<Set<PsiElement>, Alignment.Anchor> myAnchor = new HashMap<Set<PsiElement>, Alignment.Anchor>();
public void addPair(PsiElement e1, PsiElement e2, Boolean allowBackwardShift) {
addPair(e1, e2, allowBackwardShift, null);
}
public void addPair(PsiElement e1, PsiElement e2, @Nullable Boolean allowBackwardShift, @Nullable Alignment.Anchor anchor) {
LOG.assertTrue(e1 != e2);
final Set<PsiElement> set1 = myTree.get(e1);
@@ -46,9 +52,14 @@ class AlignmentProvider {
if (set1 != null && set2 != null) {
LOG.assertTrue(!myAlignments.containsKey(set1) || !myAlignments.containsKey(set2));
LOG.assertTrue(myAllowBackwardShift.get(set1).booleanValue() == myAllowBackwardShift.get(set2).booleanValue());
LOG.assertTrue(myAnchor.get(set1) == myAnchor.get(set2));
if (allowBackwardShift != null) {
LOG.assertTrue(myAllowBackwardShift.get(set1).booleanValue() == allowBackwardShift.booleanValue());
}
if (anchor != null) {
LOG.assertTrue(myAnchor.get(set1) == anchor);
}
if (myAlignments.containsKey(set2)) {
for (Iterator<PsiElement> iterator = set1.iterator(); iterator.hasNext(); ) {
PsiElement element = iterator.next();
@@ -71,12 +82,18 @@ class AlignmentProvider {
if (allowBackwardShift != null) {
LOG.assertTrue(myAllowBackwardShift.get(set1).booleanValue() == allowBackwardShift.booleanValue());
}
if (anchor != null) {
LOG.assertTrue(myAnchor.get(set1) == anchor);
}
addInternal(set1, e2);
}
else if (set2 != null) {
if (allowBackwardShift != null) {
LOG.assertTrue(myAllowBackwardShift.get(set2).booleanValue() == allowBackwardShift.booleanValue());
}
if (anchor != null) {
LOG.assertTrue(myAnchor.get(set2) == anchor);
}
addInternal(set2, e1);
}
else {
@@ -84,7 +101,7 @@ class AlignmentProvider {
addInternal(set, e1);
addInternal(set, e2);
myAllowBackwardShift.put(set, allowBackwardShift);
myAnchor.put(set, anchor);
}
}
@@ -109,12 +126,17 @@ class AlignmentProvider {
}
private void add(PsiElement element, boolean allowBackwardShift) {
add(element, allowBackwardShift, Alignment.Anchor.LEFT);
}
private void add(PsiElement element, boolean allowBackwardShift, @NotNull Alignment.Anchor anchor) {
if (myTree.get(element) != null) return;
final HashSet<PsiElement> set = createHashSet();
set.add(element);
myTree.put(element, set);
myAllowBackwardShift.put(set, allowBackwardShift);
myAnchor.put(set, anchor);
}
@Nullable
@@ -127,19 +149,19 @@ class AlignmentProvider {
Alignment alignment = myAlignments.get(set);
if (alignment != null) return alignment;
alignment = Alignment.createAlignment(myAllowBackwardShift.get(set));
alignment = Alignment.createAlignment(myAllowBackwardShift.get(set), myAnchor.get(set));
myAlignments.put(set, alignment);
return alignment;
}
public Aligner createAligner(PsiElement expression, boolean allowBackwardShift) {
Aligner aligner = new Aligner(allowBackwardShift);
aligner.append(expression);
return aligner;
public Aligner createAligner(boolean allowBackwardShift) {
return new Aligner(allowBackwardShift, Alignment.Anchor.LEFT);
}
public Aligner createAligner(boolean allowBackwardShift) {
return new Aligner(allowBackwardShift);
public Aligner createAligner(PsiElement element, boolean allowBackwardShift, Alignment.Anchor anchor) {
final Aligner aligner = new Aligner(allowBackwardShift, anchor);
aligner.append(element);
return aligner;
}
/**
@@ -151,9 +173,12 @@ class AlignmentProvider {
class Aligner {
private PsiElement myRef = null;
private boolean allowBackwardShift = true;
@NotNull
private final Alignment.Anchor myAnchor;
Aligner(boolean allowBackwardShift) {
Aligner(boolean allowBackwardShift, @NotNull Alignment.Anchor anchor) {
this.allowBackwardShift = allowBackwardShift;
myAnchor = anchor;
}
void append(@Nullable PsiElement element) {
@@ -161,10 +186,10 @@ class AlignmentProvider {
if (myRef == null) {
myRef = element;
add(element, allowBackwardShift);
add(element, allowBackwardShift, myAnchor);
}
else {
addPair(myRef, element, allowBackwardShift);
addPair(myRef, element, allowBackwardShift, myAnchor);
}
}
}

View File

@@ -228,7 +228,7 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
else {
currentGroup = new ArrayList<AlignmentProvider.Aligner>();
for (LeafPsiElement expression : table) {
currentGroup.add(myAlignmentProvider.createAligner(expression, true));
currentGroup.add(myAlignmentProvider.createAligner(expression, true, Alignment.Anchor.RIGHT));
}
}
}
@@ -294,7 +294,7 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
}
private static boolean isTablePart(PsiElement psi) {
return psi instanceof GrBinaryExpression && mBOR == ((GrBinaryExpression)psi).getOperationTokenType();
return psi instanceof GrBinaryExpression && (mBOR == ((GrBinaryExpression)psi).getOperationTokenType() || mLOR == ((GrBinaryExpression)psi).getOperationTokenType());
}
private static List<ASTNode> visibleChildren(ASTNode node) {