|
12 | 12 | package org.eclipse.lsp4j.generator |
13 | 13 |
|
14 | 14 | import com.google.gson.annotations.JsonAdapter |
| 15 | +import org.eclipse.lsp4j.jsonrpc.ProtocolDeprecated |
| 16 | +import org.eclipse.lsp4j.jsonrpc.ProtocolDraft |
| 17 | +import org.eclipse.lsp4j.jsonrpc.ProtocolSince |
15 | 18 | import org.eclipse.lsp4j.jsonrpc.validation.NonNull |
16 | 19 | import org.eclipse.xtend.lib.annotations.AccessorsProcessor |
17 | 20 | import org.eclipse.xtend.lib.annotations.EqualsHashCodeProcessor |
@@ -58,33 +61,43 @@ class JsonRpcDataProcessor extends AbstractClassProcessor { |
58 | 61 | !static |
59 | 62 | ].forEach [ field | |
60 | 63 | val accessorsUtil = new AccessorsProcessor.Util(context) |
61 | | - val deprecated = field.findAnnotation(Deprecated.findTypeGlobally) |
62 | | - accessorsUtil.addGetter(field, Visibility.PUBLIC) |
| 64 | + val protocolDraft = field.findAnnotation(ProtocolDraft.newTypeReference.type) |
| 65 | + val protocolSince = field.findAnnotation(ProtocolSince.newTypeReference.type) |
| 66 | + val protocolDeprecated = field.findAnnotation(ProtocolDeprecated.newTypeReference.type) |
63 | 67 | val hasNonNull = field.findAnnotation(NonNull.newTypeReference.type) !== null |
64 | 68 | val hasJsonAdapter = field.findAnnotation(JsonAdapter.newTypeReference.type) !== null |
| 69 | + accessorsUtil.addGetter(field, Visibility.PUBLIC) |
65 | 70 | impl.findDeclaredMethod(accessorsUtil.getGetterName(field)) => [ |
66 | 71 | docComment = field.docComment |
| 72 | + if (protocolDraft !== null) |
| 73 | + addAnnotation(protocolDraft) |
| 74 | + if (protocolSince !== null) |
| 75 | + addAnnotation(protocolSince) |
| 76 | + if (protocolDeprecated !== null) |
| 77 | + addAnnotation(protocolDeprecated) |
67 | 78 | if (hasNonNull) { |
68 | 79 | addAnnotation(newAnnotationReference(NonNull)) |
69 | 80 | } |
70 | | - if (deprecated !== null) |
71 | | - addAnnotation(newAnnotationReference(Deprecated)) |
72 | 81 | ] |
73 | 82 |
|
74 | 83 | if (!field.type.inferred) { |
75 | 84 | accessorsUtil.addSetter(field, Visibility.PUBLIC) |
76 | 85 | val setterName = accessorsUtil.getSetterName(field) |
77 | 86 | impl.findDeclaredMethod(setterName, field.type) => [ |
78 | 87 | docComment = field.docComment |
| 88 | + if (protocolDraft !== null) |
| 89 | + addAnnotation(protocolDraft) |
| 90 | + if (protocolSince !== null) |
| 91 | + addAnnotation(protocolSince) |
| 92 | + if (protocolDeprecated !== null) |
| 93 | + addAnnotation(protocolDeprecated) |
79 | 94 | if (hasNonNull) { |
80 | 95 | val parameter = parameters.head |
81 | 96 | parameter.addAnnotation(newAnnotationReference(NonNull)) |
82 | 97 | body = ''' |
83 | 98 | this.«field.simpleName» = «getPreconditionsUtil(impl, context)».checkNotNull(«parameter.simpleName», "«field.simpleName»"); |
84 | 99 | ''' |
85 | 100 | } |
86 | | - if (deprecated !== null) |
87 | | - addAnnotation(newAnnotationReference(Deprecated)) |
88 | 101 | ] |
89 | 102 | val childTypes = field.type.childTypes |
90 | 103 | if (!childTypes.empty) { |
|
0 commit comments