Move IfNotParsed interface to separate class

This commit is contained in:
Nikolay Krasko
2012-06-15 16:20:03 +04:00
parent 0171e528da
commit 3c1fb3951b
6 changed files with 33 additions and 17 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2010-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.
*/
package org.jetbrains.jet.lang.psi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Comes along with @Nullable to indicate null is only possible if parsing error present
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface IfNotParsed {}
@@ -24,11 +24,6 @@ import com.intellij.psi.PsiElementVisitor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.plugin.JetLanguage;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author max
*/
@@ -37,13 +32,6 @@ public class JetElementImpl extends ASTWrapperPsiElement implements JetElement {
super(node);
}
/**
* Comes along with @Nullable to indicate null is only possible if parsing error present
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface IfNotParsed {}
@NotNull
@Override
public Language getLanguage() {
@@ -191,7 +191,7 @@ public class JetPsiUtil {
return firstPart.child(functionName);
}
@Nullable @JetElementImpl.IfNotParsed
@Nullable @IfNotParsed
public static ImportPath getImportPath(JetImportDirective importDirective) {
final JetExpression importedReference = importDirective.getImportedReference();
if (importedReference == null) {
@@ -25,7 +25,6 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.parsing.JetExpressionParsing;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lexer.JetTokens;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
*/
public interface ValueArgument {
@Nullable
@JetElementImpl.IfNotParsed
@IfNotParsed
JetExpression getArgumentExpression();
@Nullable
@@ -32,8 +32,8 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
import org.jetbrains.jet.lang.psi.IfNotParsed;
import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetElementImpl;
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
import java.io.File;
@@ -103,7 +103,7 @@ public class JetParsingTest extends ParsingTestCase {
Object result = method.invoke(elem);
if (result == null) {
for (Annotation annotation : method.getDeclaredAnnotations()) {
if (annotation instanceof JetElementImpl.IfNotParsed) {
if (annotation instanceof IfNotParsed) {
assertNotNull(
"Incomplete operation in parsed OK test, method " + methodName +
" in " + declaringClass.getSimpleName() + " returns null. Element text: \n" + elem.getText(),