View | Details | Raw Unified | Return to bug 168088 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java (-15 / +20 lines)
Lines 335-343 Link Here
335
				if ((this.flags & FIELD_INITIALIZATION) != 0) {
335
				if ((this.flags & FIELD_INITIALIZATION) != 0) {
336
					if (hasDefaultValue) {
336
					if (hasDefaultValue) {
337
						char[] defaultValueSource = CharOperation.subarray(getSource(), annotationMethodInfo.defaultValueStart, annotationMethodInfo.defaultValueEnd+1);
337
						char[] defaultValueSource = CharOperation.subarray(getSource(), annotationMethodInfo.defaultValueStart, annotationMethodInfo.defaultValueEnd+1);
338
						Expression expression =  parseMemberValue(defaultValueSource);
338
						if (defaultValueSource != null) {
339
						if (expression != null) {
339
    						Expression expression =  parseMemberValue(defaultValueSource);
340
							annotationMethodDeclaration.defaultValue = expression;
340
    						if (expression != null) {
341
    							annotationMethodDeclaration.defaultValue = expression;
342
    						}
343
						} else {
344
							// could not retrieve the default value
345
							hasDefaultValue = false;
341
						}
346
						}
342
					}
347
					}
343
				}
348
				}
Lines 598-612 Link Here
598
			int start = (int) (position >>> 32);
603
			int start = (int) (position >>> 32);
599
			int end = (int) position;
604
			int end = (int) position;
600
			char[] annotationSource = CharOperation.subarray(cuSource, start, end+1);
605
			char[] annotationSource = CharOperation.subarray(cuSource, start, end+1);
601
			Expression expression = parseMemberValue(annotationSource);
606
			if (annotationSource != null) {
602
			/*
607
    			Expression expression = parseMemberValue(annotationSource);
603
			 * expression can be null or not an annotation if the source has changed between
608
    			/*
604
			 * the moment where the annotation source positions have been retrieved and the moment were
609
    			 * expression can be null or not an annotation if the source has changed between
605
			 * this parsing occured.
610
    			 * the moment where the annotation source positions have been retrieved and the moment were
606
			 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916
611
    			 * this parsing occured.
607
			 */
612
    			 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=90916
608
			if (expression instanceof Annotation) {
613
    			 */
609
				annotations[recordedAnnotations++] = (Annotation) expression;
614
    			if (expression instanceof Annotation) {
615
    				annotations[recordedAnnotations++] = (Annotation) expression;
616
    			}
610
			}
617
			}
611
		}
618
		}
612
		if (length != recordedAnnotations) {
619
		if (length != recordedAnnotations) {
Lines 1124-1132 Link Here
1124
	}
1131
	}
1125
	
1132
	
1126
	private Expression parseMemberValue(char[] memberValue) {
1133
	private Expression parseMemberValue(char[] memberValue) {
1127
		if (memberValue == null) {
1134
		// memberValue must not be null
1128
			return null;
1129
		}
1130
		if (this.parser == null) {
1135
		if (this.parser == null) {
1131
			this.parser = new Parser(this.problemReporter, true);
1136
			this.parser = new Parser(this.problemReporter, true);
1132
		}
1137
		}

Return to bug 168088