--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Sep 27 14:05:33 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Sep 27 14:20:39 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2473,6 +2473,11 @@
defs.append(importDeclaration());
} else {
JCTree def = typeDeclaration(mods);
+ if (keepDocComments && dc != null && docComments.get(def) == dc) {
+ // If the first type declaration has consumed the first doc
+ // comment, then don't use it for the top level comment as well.
+ dc = null;
+ }
if (def instanceof JCExpressionStatement)
def = ((JCExpressionStatement)def).expr;
defs.append(def);