JDK-4917091 : javac rejects array over 128 in length
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-09-04
  • Updated: 2010-12-21
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b123Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
While JVM spec limits the array size to 255, 

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#41115
> ------
> The number of dimensions in an array is limited to 255 by the size of the 
> dimensions opcode of the multianewarray instruction and by the constraints 
> imposed on the multianewarray, anewarray, and newarray instructions by ��4.8.2.
> ------

jdk 1.4 javac rejects an array that's over 128.   Below is the test.

> /java/re/j2se/1.4.2/arcchive/fcs/binaries/solaris-sparc/bin/javac Test.java
Test.java:2: array type has too many dimensions
            static Object expected = (Object)new Object
                                             ^
1 error

public class Test {
            static Object expected = (Object)new Object
                [1/*001*/][1/*002*/][1/*003*/][1/*004*/][1/*005*/]
                [1/*006*/][1/*007*/][1/*008*/][1/*009*/][1/*010*/]
                [1/*011*/][1/*012*/][1/*013*/][1/*014*/][1/*015*/]
                [1/*016*/][1/*017*/][1/*018*/][1/*019*/][1/*020*/]
                [1/*021*/][1/*022*/][1/*023*/][1/*024*/][1/*025*/]
                [1/*026*/][1/*027*/][1/*028*/][1/*029*/][1/*030*/]
                [1/*031*/][1/*032*/][1/*033*/][1/*034*/][1/*035*/]
                [1/*036*/][1/*037*/][1/*038*/][1/*039*/][1/*040*/]
                [1/*041*/][1/*042*/][1/*043*/][1/*044*/][1/*045*/]
                [1/*046*/][1/*047*/][1/*048*/][1/*049*/][1/*050*/]
                [1/*051*/][1/*052*/][1/*053*/][1/*054*/][1/*055*/]
                [1/*056*/][1/*057*/][1/*058*/][1/*059*/][1/*060*/]
                [1/*061*/][1/*062*/][1/*063*/][1/*064*/][1/*065*/]
                [1/*066*/][1/*067*/][1/*068*/][1/*069*/][1/*070*/]
                [1/*071*/][1/*072*/][1/*073*/][1/*074*/][1/*075*/]
                [1/*076*/][1/*077*/][1/*078*/][1/*079*/][1/*080*/]
                [1/*081*/][1/*082*/][1/*083*/][1/*084*/][1/*085*/]
                [1/*086*/][1/*087*/][1/*088*/][1/*089*/][1/*090*/]
                [1/*091*/][1/*092*/][1/*093*/][1/*094*/][1/*095*/]
                [1/*096*/][1/*097*/][1/*098*/][1/*099*/][1/*100*/]
                [1/*101*/][1/*102*/][1/*103*/][1/*104*/][1/*105*/]
                [1/*106*/][1/*107*/][1/*108*/][1/*109*/][1/*110*/]
                [1/*111*/][1/*112*/][1/*113*/][1/*114*/][1/*115*/]
                [1/*116*/][1/*117*/][1/*118*/][1/*119*/][1/*120*/]
                [1/*121*/][1/*122*/][1/*123*/][1/*124*/][1/*125*/]
                [1/*126*/][1/*127*/][1/*128*/][1/*129*/];
}
###@###.### 10/25/04 21:57 GMT

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/build/langtools/rev/bcf44475aeee
25-12-2010

EVALUATION Main spec reference here is JVMS 3, 4.3.2 which says that the type descriptor for any array is limited to 255 dimensions. This means you can't even allocate (for example) a two-dimensional array of elements which are in turn 254-dimensional arrays, because the cumulative dimensionality exceeds the limits on the array type descriptor.
09-12-2010

EVALUATION The compiler confuses an array's component type with its element type. So it gets a wrong dimension while checking limit.
08-12-2006

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-07-2004

PUBLIC COMMENTS ...
17-07-2004

EVALUATION Looks like a bug. ###@###.### 2003-09-05
05-09-2003