rsense-core 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +1 -0
  5. data/README.md +35 -0
  6. data/Rakefile +84 -0
  7. data/TypeAnnotation.tokens +41 -0
  8. data/build.xml +84 -0
  9. data/build_lib/antlr-3.2.jar +0 -0
  10. data/lib/jars/ant-1.7.0.jar +0 -0
  11. data/lib/jars/ant-launcher-1.7.0.jar +0 -0
  12. data/lib/jars/antlr-runtime-3.2.jar +0 -0
  13. data/lib/jars/bsf-2.3.0.jar +0 -0
  14. data/lib/rsense-core.rb +28 -0
  15. data/lib/rsense.jar +0 -0
  16. data/lib/rsense/core.rb +5 -0
  17. data/lib/rsense/core/version.rb +5 -0
  18. data/lib/rsense/parser.rb +6 -0
  19. data/lib/rsense/ruby.rb +19 -0
  20. data/lib/rsense/typing.rb +13 -0
  21. data/lib/rsense/typing/annotation.rb +20 -0
  22. data/lib/rsense/typing/runtime.rb +23 -0
  23. data/lib/rsense/typing/vertex.rb +15 -0
  24. data/lib/rsense/util.rb +9 -0
  25. data/rsense-core.gemspec +30 -0
  26. data/src/org/cx4a/rsense/CodeAssist.java +744 -0
  27. data/src/org/cx4a/rsense/CodeAssistError.java +31 -0
  28. data/src/org/cx4a/rsense/CodeAssistResult.java +42 -0
  29. data/src/org/cx4a/rsense/CodeCompletionResult.java +65 -0
  30. data/src/org/cx4a/rsense/FindDefinitionResult.java +24 -0
  31. data/src/org/cx4a/rsense/LoadResult.java +19 -0
  32. data/src/org/cx4a/rsense/Main.java +916 -0
  33. data/src/org/cx4a/rsense/Options.java +353 -0
  34. data/src/org/cx4a/rsense/Project.java +103 -0
  35. data/src/org/cx4a/rsense/TypeInferenceResult.java +25 -0
  36. data/src/org/cx4a/rsense/WhereResult.java +19 -0
  37. data/src/org/cx4a/rsense/parser/TypeAnnotation.g +221 -0
  38. data/src/org/cx4a/rsense/parser/TypeAnnotationLexer.java +1759 -0
  39. data/src/org/cx4a/rsense/parser/TypeAnnotationParser.java +2025 -0
  40. data/src/org/cx4a/rsense/ruby/Block.java +10 -0
  41. data/src/org/cx4a/rsense/ruby/Context.java +75 -0
  42. data/src/org/cx4a/rsense/ruby/DynamicMethod.java +10 -0
  43. data/src/org/cx4a/rsense/ruby/DynamicScope.java +51 -0
  44. data/src/org/cx4a/rsense/ruby/Frame.java +95 -0
  45. data/src/org/cx4a/rsense/ruby/IRubyObject.java +17 -0
  46. data/src/org/cx4a/rsense/ruby/LocalScope.java +43 -0
  47. data/src/org/cx4a/rsense/ruby/MetaClass.java +50 -0
  48. data/src/org/cx4a/rsense/ruby/Ruby.java +242 -0
  49. data/src/org/cx4a/rsense/ruby/RubyClass.java +146 -0
  50. data/src/org/cx4a/rsense/ruby/RubyModule.java +255 -0
  51. data/src/org/cx4a/rsense/ruby/RubyObject.java +94 -0
  52. data/src/org/cx4a/rsense/ruby/Scope.java +7 -0
  53. data/src/org/cx4a/rsense/ruby/SpecialObject.java +15 -0
  54. data/src/org/cx4a/rsense/ruby/Visibility.java +17 -0
  55. data/src/org/cx4a/rsense/typing/Graph.java +1690 -0
  56. data/src/org/cx4a/rsense/typing/Propagation.java +73 -0
  57. data/src/org/cx4a/rsense/typing/Template.java +84 -0
  58. data/src/org/cx4a/rsense/typing/TemplateAttribute.java +158 -0
  59. data/src/org/cx4a/rsense/typing/TypeSet.java +48 -0
  60. data/src/org/cx4a/rsense/typing/annotation/ClassType.java +57 -0
  61. data/src/org/cx4a/rsense/typing/annotation/MethodType.java +79 -0
  62. data/src/org/cx4a/rsense/typing/annotation/TypeAnnotation.java +4 -0
  63. data/src/org/cx4a/rsense/typing/annotation/TypeAny.java +7 -0
  64. data/src/org/cx4a/rsense/typing/annotation/TypeApplication.java +37 -0
  65. data/src/org/cx4a/rsense/typing/annotation/TypeConstraint.java +29 -0
  66. data/src/org/cx4a/rsense/typing/annotation/TypeExpression.java +11 -0
  67. data/src/org/cx4a/rsense/typing/annotation/TypeIdentity.java +59 -0
  68. data/src/org/cx4a/rsense/typing/annotation/TypeOptional.java +22 -0
  69. data/src/org/cx4a/rsense/typing/annotation/TypePragma.java +22 -0
  70. data/src/org/cx4a/rsense/typing/annotation/TypeSplat.java +22 -0
  71. data/src/org/cx4a/rsense/typing/annotation/TypeTuple.java +35 -0
  72. data/src/org/cx4a/rsense/typing/annotation/TypeUnion.java +23 -0
  73. data/src/org/cx4a/rsense/typing/annotation/TypeVariable.java +44 -0
  74. data/src/org/cx4a/rsense/typing/runtime/AliasMethod.java +94 -0
  75. data/src/org/cx4a/rsense/typing/runtime/AnnotationHelper.java +69 -0
  76. data/src/org/cx4a/rsense/typing/runtime/AnnotationResolver.java +523 -0
  77. data/src/org/cx4a/rsense/typing/runtime/Array.java +84 -0
  78. data/src/org/cx4a/rsense/typing/runtime/ClassTag.java +27 -0
  79. data/src/org/cx4a/rsense/typing/runtime/DefaultMethod.java +115 -0
  80. data/src/org/cx4a/rsense/typing/runtime/Hash.java +131 -0
  81. data/src/org/cx4a/rsense/typing/runtime/LoopTag.java +21 -0
  82. data/src/org/cx4a/rsense/typing/runtime/Method.java +32 -0
  83. data/src/org/cx4a/rsense/typing/runtime/MonomorphicObject.java +77 -0
  84. data/src/org/cx4a/rsense/typing/runtime/ObjectAllocator.java +40 -0
  85. data/src/org/cx4a/rsense/typing/runtime/PolymorphicObject.java +90 -0
  86. data/src/org/cx4a/rsense/typing/runtime/Proc.java +100 -0
  87. data/src/org/cx4a/rsense/typing/runtime/RuntimeHelper.java +1339 -0
  88. data/src/org/cx4a/rsense/typing/runtime/SpecialMethod.java +119 -0
  89. data/src/org/cx4a/rsense/typing/runtime/TypeVarMap.java +112 -0
  90. data/src/org/cx4a/rsense/typing/runtime/VertexHolder.java +48 -0
  91. data/src/org/cx4a/rsense/typing/vertex/CallVertex.java +122 -0
  92. data/src/org/cx4a/rsense/typing/vertex/MultipleAsgnVertex.java +23 -0
  93. data/src/org/cx4a/rsense/typing/vertex/PassThroughVertex.java +20 -0
  94. data/src/org/cx4a/rsense/typing/vertex/SValueVertex.java +24 -0
  95. data/src/org/cx4a/rsense/typing/vertex/SplatVertex.java +24 -0
  96. data/src/org/cx4a/rsense/typing/vertex/ToAryVertex.java +24 -0
  97. data/src/org/cx4a/rsense/typing/vertex/TypeVarVertex.java +22 -0
  98. data/src/org/cx4a/rsense/typing/vertex/Vertex.java +221 -0
  99. data/src/org/cx4a/rsense/typing/vertex/YieldVertex.java +70 -0
  100. data/src/org/cx4a/rsense/util/HereDocReader.java +48 -0
  101. data/src/org/cx4a/rsense/util/Logger.java +111 -0
  102. data/src/org/cx4a/rsense/util/NodeUtil.java +198 -0
  103. data/src/org/cx4a/rsense/util/SourceLocation.java +70 -0
  104. data/src/org/cx4a/rsense/util/StringUtil.java +63 -0
  105. data/src/resources/org/cx4a/rsense/rsense.properties +1 -0
  106. data/stubs/1.8/_builtin.rb +3006 -0
  107. data/stubs/1.8/bigdecimal.rb +131 -0
  108. data/stubs/1.8/cgi.rb +257 -0
  109. data/stubs/1.8/date.rb +147 -0
  110. data/stubs/1.8/optparse.rb +113 -0
  111. data/stubs/1.8/rational.rb +47 -0
  112. data/stubs/1.8/set.rb +94 -0
  113. data/stubs/1.8/socket.rb +461 -0
  114. data/stubs/1.8/stringio.rb +129 -0
  115. data/test/data/a file.rb +1 -0
  116. data/test/data/benchmark.rb +12 -0
  117. data/test/data/crlf.rb +5 -0
  118. data/test/data/test.rb +19 -0
  119. data/test/script/all.rsense +2 -0
  120. data/test/script/array_dynamic.rsense +25 -0
  121. data/test/script/block_nested.rsense +7 -0
  122. data/test/script/builtin.rsense +785 -0
  123. data/test/script/class_method_partial_update.rsense +52 -0
  124. data/test/script/class_partial_update.rsense +17 -0
  125. data/test/script/find-definition.rsense +72 -0
  126. data/test/script/method_arg_onearg.rsense +6 -0
  127. data/test/script/method_arg_optional.rsense +7 -0
  128. data/test/script/method_partial_update.rsense +14 -0
  129. data/test/script/method_yield_arrayarg.rsense +8 -0
  130. data/test/script/method_yield_arrayarg_expand.rsense +8 -0
  131. data/test/script/method_yield_arrayarg_splat.rsense +17 -0
  132. data/test/script/misc.rsense +2 -0
  133. data/test/script/proc_higher_order.rsense +22 -0
  134. data/test/script/regression.rsense +95 -0
  135. data/test/script/stdlib.rsense +66 -0
  136. data/test/script/where.rsense +41 -0
  137. metadata +315 -0
@@ -0,0 +1,4 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public interface TypeAnnotation {
4
+ }
@@ -0,0 +1,7 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeAny implements TypeExpression {
4
+ public Type getType() {
5
+ return Type.ANY;
6
+ }
7
+ }
@@ -0,0 +1,37 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ import java.util.List;
4
+
5
+ public class TypeApplication implements TypeExpression {
6
+ private TypeIdentity ident;
7
+ private List<TypeExpression> types;
8
+
9
+ public TypeApplication(TypeIdentity ident, List<TypeExpression> types) {
10
+ this.ident = ident;
11
+ this.types = types;
12
+ }
13
+
14
+ public TypeIdentity getIdentity() {
15
+ return ident;
16
+ }
17
+
18
+ public List<TypeExpression> getTypes() {
19
+ return types;
20
+ }
21
+
22
+ public Type getType() {
23
+ return Type.APPLICATION;
24
+ }
25
+
26
+ @Override
27
+ public String toString() {
28
+ StringBuilder sb = new StringBuilder();
29
+ sb.append(ident.toString());
30
+ sb.append('<');
31
+ for (TypeExpression type : types) {
32
+ sb.append(type.toString());
33
+ }
34
+ sb.append('>');
35
+ return sb.toString();
36
+ }
37
+ }
@@ -0,0 +1,29 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeConstraint implements TypeExpression {
4
+ private Type type;
5
+ private TypeExpression lhs, rhs;
6
+
7
+ public TypeConstraint(Type type, TypeExpression lhs, TypeExpression rhs) {
8
+ this.type = type;
9
+ this.lhs = lhs;
10
+ this.rhs = rhs;
11
+ }
12
+
13
+ public Type getType() {
14
+ return type;
15
+ }
16
+
17
+ public TypeExpression lhs() {
18
+ return lhs;
19
+ }
20
+
21
+ public TypeExpression rhs() {
22
+ return rhs;
23
+ }
24
+
25
+ @Override
26
+ public String toString() {
27
+ return lhs + " <= " + rhs;
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public interface TypeExpression {
4
+ public enum Type { RELATIVE_IDENTITY, SCOPED_IDENTITY, ABSOLUTE_IDENTITY,
5
+ UNION, VARIABLE, ANY, OPTIONAL,
6
+ TUPLE, SPLAT, APPLICATION, SUBTYPE_CONS,
7
+ NOBODY_PRAGMA,
8
+ }
9
+
10
+ public Type getType();
11
+ }
@@ -0,0 +1,59 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeIdentity implements TypeExpression {
4
+ private Type type;
5
+ private String name;
6
+ private TypeIdentity path;
7
+
8
+ private TypeIdentity(Type type) {
9
+ this.type = type;
10
+ }
11
+
12
+ private TypeIdentity(Type type, String name) {
13
+ this(type, name, null);
14
+ }
15
+
16
+ private TypeIdentity(Type type, TypeIdentity path) {
17
+ this(type, null, path);
18
+ }
19
+
20
+ private TypeIdentity(Type type, String name, TypeIdentity path) {
21
+ this.type = type;
22
+ this.name = name;
23
+ this.path = path;
24
+ }
25
+
26
+ public Type getType() {
27
+ return type;
28
+ }
29
+
30
+ public String getName() {
31
+ return name;
32
+ }
33
+
34
+ public TypeIdentity getPath() {
35
+ return path;
36
+ }
37
+
38
+ public static TypeIdentity newRelativeIdentity(String name) {
39
+ return new TypeIdentity(Type.RELATIVE_IDENTITY, name);
40
+ }
41
+
42
+ public static TypeIdentity newScopedIdentity(String name, TypeIdentity path) {
43
+ return new TypeIdentity(Type.SCOPED_IDENTITY, name, path);
44
+ }
45
+
46
+ public static TypeIdentity newAbsoluteIdentity(TypeIdentity path) {
47
+ return new TypeIdentity(Type.ABSOLUTE_IDENTITY, path);
48
+ }
49
+
50
+ @Override
51
+ public String toString() {
52
+ switch (type) {
53
+ case RELATIVE_IDENTITY:
54
+ return "$" + name;
55
+ default:
56
+ return "?" + name;
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,22 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeOptional implements TypeExpression {
4
+ private TypeExpression expr;
5
+
6
+ public TypeOptional(TypeExpression expr) {
7
+ this.expr = expr;
8
+ }
9
+
10
+ public TypeExpression getExpression() {
11
+ return expr;
12
+ }
13
+
14
+ public Type getType() {
15
+ return Type.OPTIONAL;
16
+ }
17
+
18
+ @Override
19
+ public String toString() {
20
+ return "?" + expr;
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypePragma implements TypeExpression {
4
+ private Type type;
5
+
6
+ public TypePragma(Type type) {
7
+ this.type = type;
8
+ }
9
+
10
+ public Type getType() {
11
+ return type;
12
+ }
13
+
14
+ @Override
15
+ public String toString() {
16
+ switch (type) {
17
+ case NOBODY_PRAGMA:
18
+ return "!nobody";
19
+ }
20
+ return "unknown-pragma";
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeSplat implements TypeExpression {
4
+ private TypeExpression expr;
5
+
6
+ public TypeSplat(TypeExpression expr) {
7
+ this.expr = expr;
8
+ }
9
+
10
+ public TypeExpression getExpression() {
11
+ return expr;
12
+ }
13
+
14
+ public Type getType() {
15
+ return Type.SPLAT;
16
+ }
17
+
18
+ @Override
19
+ public String toString() {
20
+ return expr != null ? "*" + expr.toString() : "*";
21
+ }
22
+ }
@@ -0,0 +1,35 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ import java.util.List;
4
+
5
+ public class TypeTuple implements TypeExpression {
6
+ private List<TypeExpression> elements;
7
+
8
+ public TypeTuple(List<TypeExpression> elements) {
9
+ this.elements = elements;
10
+ }
11
+
12
+ public List<TypeExpression> getList() {
13
+ return elements;
14
+ }
15
+
16
+ public Type getType() {
17
+ return Type.TUPLE;
18
+ }
19
+
20
+ @Override
21
+ public String toString() {
22
+ StringBuilder sb = new StringBuilder();
23
+ String delim = "";
24
+ sb.append("(");
25
+ if (elements != null) {
26
+ for (TypeExpression expr : elements) {
27
+ sb.append(delim);
28
+ delim = ", ";
29
+ sb.append(expr.toString());
30
+ }
31
+ }
32
+ sb.append(")");
33
+ return sb.toString();
34
+ }
35
+ }
@@ -0,0 +1,23 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ import java.util.ArrayList;
4
+
5
+ public class TypeUnion extends ArrayList<TypeExpression> implements TypeExpression {
6
+ private static final long serialVersionUID = 0L;
7
+
8
+ public Type getType() {
9
+ return Type.UNION;
10
+ }
11
+
12
+ @Override
13
+ public String toString() {
14
+ StringBuilder sb = new StringBuilder();
15
+ String delim = "";
16
+ for (TypeExpression expr : this) {
17
+ sb.append(delim);
18
+ delim = " or ";
19
+ sb.append(expr);
20
+ }
21
+ return sb.toString();
22
+ }
23
+ }
@@ -0,0 +1,44 @@
1
+ package org.cx4a.rsense.typing.annotation;
2
+
3
+ public class TypeVariable implements TypeExpression {
4
+ private String name;
5
+
6
+ public TypeVariable(String name) {
7
+ this.name = name;
8
+ }
9
+
10
+ public String getName() {
11
+ return name;
12
+ }
13
+
14
+ public Type getType() {
15
+ return Type.VARIABLE;
16
+ }
17
+
18
+ @Override
19
+ public String toString() {
20
+ return "@" + name;
21
+ }
22
+
23
+ @Override
24
+ public int hashCode() {
25
+ return name.hashCode();
26
+ }
27
+
28
+ @Override
29
+ public boolean equals(Object other) {
30
+ if (this == other) {
31
+ return true;
32
+ }
33
+
34
+ if (!(other instanceof TypeVariable)) {
35
+ return false;
36
+ }
37
+
38
+ return name.equals(((TypeVariable) other).name);
39
+ }
40
+
41
+ public static TypeVariable valueOf(String name) {
42
+ return new TypeVariable(name);
43
+ }
44
+ }
@@ -0,0 +1,94 @@
1
+ package org.cx4a.rsense.typing.runtime;
2
+
3
+ import java.lang.ref.SoftReference;
4
+
5
+ import java.util.List;
6
+ import java.util.Map;
7
+
8
+ import org.jrubyparser.ast.Node;
9
+
10
+ import org.cx4a.rsense.ruby.IRubyObject;
11
+ import org.cx4a.rsense.ruby.RubyModule;
12
+ import org.cx4a.rsense.ruby.Block;
13
+ import org.cx4a.rsense.ruby.Visibility;
14
+ import org.cx4a.rsense.typing.Graph;
15
+ import org.cx4a.rsense.typing.Template;
16
+ import org.cx4a.rsense.typing.TemplateAttribute;
17
+ import org.cx4a.rsense.typing.vertex.Vertex;
18
+ import org.cx4a.rsense.typing.annotation.MethodType;
19
+ import org.cx4a.rsense.util.SourceLocation;
20
+
21
+ public class AliasMethod implements Method {
22
+ private String newName;
23
+ private Method method;
24
+
25
+ public AliasMethod(String newName, Method method) {
26
+ this.newName = newName;
27
+ this.method = method;
28
+ }
29
+
30
+ public RubyModule getModule() {
31
+ return method.getModule();
32
+ }
33
+
34
+ public Visibility getVisibility() {
35
+ return method.getVisibility();
36
+ }
37
+
38
+ public void setVisibility(Visibility visibility) {
39
+ method.setVisibility(visibility);
40
+ }
41
+
42
+ public SourceLocation getLocation() {
43
+ return method.getLocation();
44
+ }
45
+
46
+ public String getName() {
47
+ return newName;
48
+ }
49
+
50
+ public Node getBodyNode() {
51
+ return method.getBodyNode();
52
+ }
53
+
54
+ public Node getArgsNode() {
55
+ return method.getArgsNode();
56
+ }
57
+
58
+ public void shareTemplates(Method with) {
59
+ method.shareTemplates(with);
60
+ }
61
+
62
+ public Map<TemplateAttribute, SoftReference<Template>> getTemplates() {
63
+ return method.getTemplates();
64
+ }
65
+
66
+ public Template getTemplate(TemplateAttribute key) {
67
+ return method.getTemplate(key);
68
+ }
69
+
70
+ public void addTemplate(TemplateAttribute key, Template template) {
71
+ method.addTemplate(key, template);
72
+ }
73
+
74
+ public boolean isTemplatesShared() {
75
+ return method.isTemplatesShared();
76
+ }
77
+
78
+ public List<MethodType> getAnnotations() {
79
+ return method.getAnnotations();
80
+ }
81
+
82
+ public void setAnnotations(List<MethodType> annotations) {
83
+ method.setAnnotations(annotations);
84
+ }
85
+
86
+ public Vertex call(Graph graph, Template template, IRubyObject receiver, IRubyObject[] args, Vertex[] argVertices, Block block) {
87
+ return method.call(graph, template, receiver, args, argVertices, block);
88
+ }
89
+
90
+ @Override
91
+ public String toString() {
92
+ return getModule().getMethodPath(getName());
93
+ }
94
+ }
@@ -0,0 +1,69 @@
1
+ package org.cx4a.rsense.typing.runtime;
2
+
3
+ import java.util.ArrayList;
4
+ import java.util.Collection;
5
+ import java.util.Iterator;
6
+ import java.util.List;
7
+
8
+ import org.jrubyparser.ast.CommentNode;
9
+
10
+ import org.antlr.runtime.ANTLRStringStream;
11
+ import org.antlr.runtime.CommonTokenStream;
12
+ import org.antlr.runtime.RecognitionException;
13
+
14
+ import org.cx4a.rsense.parser.TypeAnnotationLexer;
15
+ import org.cx4a.rsense.parser.TypeAnnotationParser;
16
+ import org.cx4a.rsense.typing.Graph;
17
+ import org.cx4a.rsense.typing.Template;
18
+ import org.cx4a.rsense.typing.annotation.TypeAnnotation;
19
+
20
+ public class AnnotationHelper {
21
+ private AnnotationHelper() {}
22
+
23
+ public static TypeAnnotation parseAnnotation(String annot, int lineno) {
24
+ if (annot.startsWith("##%")) {
25
+ ANTLRStringStream in = new ANTLRStringStream(annot.substring(3));
26
+ in.setLine(lineno);
27
+ TypeAnnotationLexer lex = new TypeAnnotationLexer(in);
28
+ CommonTokenStream tokens = new CommonTokenStream(lex);
29
+ TypeAnnotationParser parser = new TypeAnnotationParser(tokens);
30
+ try {
31
+ return parser.type();
32
+ } catch (RecognitionException e) {}
33
+ }
34
+ return null;
35
+ }
36
+
37
+ // Collection<CommentNode> comments = node.getComments();
38
+
39
+
40
+
41
+ public static List<TypeAnnotation> parseAnnotations(Collection<CommentNode> comments, int lineno) {
42
+ List<TypeAnnotation> annots = new ArrayList<TypeAnnotation>();
43
+ for (Iterator<CommentNode> iterator = comments.iterator(); iterator.hasNext(); )
44
+ {
45
+ CommentNode next = iterator.next();
46
+ String nodeComment = next.getContent();
47
+ TypeAnnotation annot = parseAnnotation(nodeComment, lineno);
48
+ if (annot != null) {
49
+ annots.add(annot);
50
+ }
51
+ }
52
+ return annots;
53
+ }
54
+
55
+ public static List<TypeAnnotation> parseAnnotations(List<String> commentList, int lineno) {
56
+ List<TypeAnnotation> annots = new ArrayList<TypeAnnotation>();
57
+ for (String comment : commentList) {
58
+ TypeAnnotation annot = parseAnnotation(comment.toString(), lineno);
59
+ if (annot != null) {
60
+ annots.add(annot);
61
+ }
62
+ }
63
+ return annots;
64
+ }
65
+
66
+ public static AnnotationResolver.Result resolveMethodAnnotation(Graph graph, Template template) {
67
+ return new AnnotationResolver(graph).resolveMethodAnnotation(template);
68
+ }
69
+ }