United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6926703 : apt tests should run with assertions enabled

Details
Type:
Bug
Submit Date:
2010-02-16
Status:
Closed
Updated Date:
2011-05-17
Project Name:
JDK
Resolved Date:
2011-05-17
Component:
tools
OS:
generic
Sub-Component:
apt
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

Description
Two apt regression tests fail when assetions are enabled.  The incorrect assertion should be corrected.

                                    

Comments
EVALUATION

Yes.
                                     
2010-02-16
SUGGESTED FIX

# HG changeset patch
# User darcy
# Date 1266293877 28800
# Node ID 631a273dac0f8b37eb797c9dde100973bf66eb9b
# Parent fe17a9dbef035263e5de98a66bdf3620481f7031
6926703: apt tests should run with assertions enabled
Reviewed-by: jjg

--- a/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java	Mon Feb 15 20:06:11 2010 -0800
+++ b/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java	Mon Feb 15 20:17:57 2010 -0800
@@ -101,7 +101,11 @@ class SourceOrderDeclScanner extends Dec
         }
         @SuppressWarnings("cast")
         private int compareEqualPosition(Declaration d1, Declaration d2) {
-            assert d1.getPosition() == d2.getPosition();
+            assert
+                (d1.getPosition() == d2.getPosition()) || // Handles d1 == d2 == null
+                (d1.getPosition().file().compareTo(d2.getPosition().file()) == 0 &&
+                 d1.getPosition().line()   == d2.getPosition().line() &&
+                 d1.getPosition().column() == d2.getPosition().column());
 
             DeclPartialOrder dpo1 = new DeclPartialOrder();
             DeclPartialOrder dpo2 = new DeclPartialOrder();
                                     
2010-02-16
PUBLIC COMMENTS

See
http://hg.openjdk.java.net/jdk7/tl/langtools/rev/631a273dac0f
                                     
2010-02-16



Hardware and Software, Engineered to Work Together