You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2007/01/06 21:16:31 UTC
svn commit: r493560 [2/2] - in /harmony/enhanced/classlib/trunk:
depends/files/ modules/pack200/ modules/pack200/make/
modules/pack200/src/main/java/org/apache/harmony/pack200/
modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/
modules/...
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java Sat Jan 6 12:16:29 2007
@@ -1,93 +1,93 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-
-public class CPNameAndType extends ConstantPoolEntry {
-
- CPUTF8 descriptor;
-
- transient int descriptorIndex;
-
- CPUTF8 name;
-
- transient int nameIndex;
-
- public CPNameAndType(String descriptor) {
- super(ConstantPoolEntry.CP_NameAndType);
- int colon = descriptor.indexOf(':');
- this.name = new CPUTF8(descriptor.substring(0,colon));
- this.descriptor = new CPUTF8(descriptor.substring(colon+1));
- }
-
- @Override
- protected void resolve(ClassConstantPool pool) {
- super.resolve(pool);
- descriptorIndex = pool.indexOf(descriptor);
- nameIndex = pool.indexOf(name);
- }
-
- /*
- * field_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2
- * attributes_count; attribute_info attributes[attributes_count]; }
- */
- @Override
- protected void writeBody(DataOutputStream dos) throws IOException {
- dos.writeShort(nameIndex);
- dos.writeShort(descriptorIndex);
- }
-
- @Override
- public String toString() {
- return "NameAndType: " + name + "(" + descriptor + ")";
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((descriptor == null) ? 0 : descriptor.hashCode());
- result = PRIME * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final CPNameAndType other = (CPNameAndType) obj;
- if (descriptor == null) {
- if (other.descriptor != null)
- return false;
- } else if (!descriptor.equals(other.descriptor))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+public class CPNameAndType extends ConstantPoolEntry {
+
+ CPUTF8 descriptor;
+
+ transient int descriptorIndex;
+
+ CPUTF8 name;
+
+ transient int nameIndex;
+
+ public CPNameAndType(String descriptor) {
+ super(ConstantPoolEntry.CP_NameAndType);
+ int colon = descriptor.indexOf(':');
+ this.name = new CPUTF8(descriptor.substring(0,colon));
+ this.descriptor = new CPUTF8(descriptor.substring(colon+1));
+ }
+
+ @Override
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ descriptorIndex = pool.indexOf(descriptor);
+ nameIndex = pool.indexOf(name);
+ }
+
+ /*
+ * field_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2
+ * attributes_count; attribute_info attributes[attributes_count]; }
+ */
+ @Override
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(nameIndex);
+ dos.writeShort(descriptorIndex);
+ }
+
+ @Override
+ public String toString() {
+ return "NameAndType: " + name + "(" + descriptor + ")";
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((descriptor == null) ? 0 : descriptor.hashCode());
+ result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final CPNameAndType other = (CPNameAndType) obj;
+ if (descriptor == null) {
+ if (other.descriptor != null)
+ return false;
+ } else if (!descriptor.equals(other.descriptor))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPNameAndType.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java Sat Jan 6 12:16:29 2007
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-public class CPString extends CPConstant {
- private transient int nameIndex;
- private CPUTF8 name;
-
- public CPString(java.lang.String value) {
- super(ConstantPoolEntry.CP_String,value);
- this.name = new CPUTF8((String) getValue());
-
- }
-
- @Override
- protected void writeBody(DataOutputStream dos) throws IOException {
- dos.writeShort(nameIndex);
- }
-
- @Override
- public String toString() {
- return "String: " + getValue();
- }
-
- /**
- * Allows the constant pool entries to resolve their nested entries
- *
- * @param pool
- */
- protected void resolve(ClassConstantPool pool) {
- super.resolve(pool);
- nameIndex = pool.indexOf(name);
- }
-
- protected ClassFileEntry[] getNestedClassFileEntries() {
- return new ClassFileEntry[] { name };
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class CPString extends CPConstant {
+ private transient int nameIndex;
+ private CPUTF8 name;
+
+ public CPString(java.lang.String value) {
+ super(ConstantPoolEntry.CP_String,value);
+ this.name = new CPUTF8((String) getValue());
+
+ }
+
+ @Override
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(nameIndex);
+ }
+
+ @Override
+ public String toString() {
+ return "String: " + getValue();
+ }
+
+ /**
+ * Allows the constant pool entries to resolve their nested entries
+ *
+ * @param pool
+ */
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ nameIndex = pool.indexOf(name);
+ }
+
+ protected ClassFileEntry[] getNestedClassFileEntries() {
+ return new ClassFileEntry[] { name };
+ }
+
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPString.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java Sat Jan 6 12:16:29 2007
@@ -1,77 +1,77 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-public class CPUTF8 extends ConstantPoolEntry {
- private String utf8;
-
- public CPUTF8(String utf8) {
- super(ConstantPoolEntry.CP_UTF8);
- this.utf8 = utf8;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (this.getClass() != obj.getClass())
- return false;
- final CPUTF8 other = (CPUTF8) obj;
- if (utf8 == null) {
- if (other.utf8 != null)
- return false;
- } else if (!utf8.equals(other.utf8))
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((utf8 == null) ? 0 : utf8.hashCode());
- return result;
- }
-
- public String toString() {
- return "UTF8: " + utf8;
- }
-
- protected void writeBody(DataOutputStream dos) throws IOException {
- byte[] bytes;
- try {
- // TODO Check that this is the right UTF-8 for bytes
- if (utf8 == null) {
- bytes = new byte[0];
- } else {
- bytes = utf8.getBytes("UTF-8");
- }
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("Couldn't convert string " + utf8
- + " to UTF-8");
- }
- dos.writeShort(bytes.length);
- dos.write(bytes);
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+public class CPUTF8 extends ConstantPoolEntry {
+ private String utf8;
+
+ public CPUTF8(String utf8) {
+ super(ConstantPoolEntry.CP_UTF8);
+ this.utf8 = utf8;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (this.getClass() != obj.getClass())
+ return false;
+ final CPUTF8 other = (CPUTF8) obj;
+ if (utf8 == null) {
+ if (other.utf8 != null)
+ return false;
+ } else if (!utf8.equals(other.utf8))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((utf8 == null) ? 0 : utf8.hashCode());
+ return result;
+ }
+
+ public String toString() {
+ return "UTF8: " + utf8;
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ byte[] bytes;
+ try {
+ // TODO Check that this is the right UTF-8 for bytes
+ if (utf8 == null) {
+ bytes = new byte[0];
+ } else {
+ bytes = utf8.getBytes("UTF-8");
+ }
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("Couldn't convert string " + utf8
+ + " to UTF-8");
+ }
+ dos.writeShort(bytes.length);
+ dos.write(bytes);
+ }
+
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/CPUTF8.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java Sat Jan 6 12:16:29 2007
@@ -1,90 +1,90 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-// NOTE: Do not extract strings as messages; this code is still a
-// work-in-progress
-// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-
-public class ClassConstantPool {
- public String toString() {
- return entries.toString();
- }
- private List others = new ArrayList();
-
- private List entries = new ArrayList();
-
- private boolean resolved;
-
- public ClassFileEntry add(ClassFileEntry entry) {
- // TODO this should be a set - we don't want duplicates
- // Only add in constant pools, but resolve all types since they may
- // introduce new constant pool entries
- if (entry instanceof ConstantPoolEntry) {
- if (!entries.contains(entry)) {
- entries.add(entry);
- // TODO This will be a bugger when they're sorted.
- if (entry instanceof CPLong ||entry instanceof CPDouble)
- entries.add(entry); //these get 2 slots because of their size
- }
- } else {
- if (!others.contains(entry))
- others.add(entry);
- }
- ClassFileEntry[] nestedEntries = entry.getNestedClassFileEntries();
- for (int i = 0; i < nestedEntries.length; i++) {
- add(nestedEntries[i]);
- }
- return entry;
- }
-
- public int indexOf(ClassFileEntry entry) {
- if (!resolved)
- throw new IllegalStateException("Constant pool is not yet resolved; this does not make any sense");
- return entries.indexOf(entry) + 1;
- }
-
- public int size() {
- return entries.size();
- }
-
- public ClassFileEntry get(int i) {
- if (!resolved)
- throw new IllegalStateException("Constant pool is not yet resolved; this does not make any sense");
- return (ClassFileEntry) entries.get(--i);
- }
-
- public void resolve() {
- resolved= true;
- Iterator it = entries.iterator();
- while (it.hasNext()) {
- ClassFileEntry entry = (ClassFileEntry) it.next();
- entry.resolve(this);
- }
- it = others.iterator();
- while (it.hasNext()) {
- ClassFileEntry entry = (ClassFileEntry) it.next();
- entry.resolve(this);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
+// NOTE: Do not extract strings as messages; this code is still a
+// work-in-progress
+// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class ClassConstantPool {
+ public String toString() {
+ return entries.toString();
+ }
+ private List others = new ArrayList();
+
+ private List entries = new ArrayList();
+
+ private boolean resolved;
+
+ public ClassFileEntry add(ClassFileEntry entry) {
+ // TODO this should be a set - we don't want duplicates
+ // Only add in constant pools, but resolve all types since they may
+ // introduce new constant pool entries
+ if (entry instanceof ConstantPoolEntry) {
+ if (!entries.contains(entry)) {
+ entries.add(entry);
+ // TODO This will be a bugger when they're sorted.
+ if (entry instanceof CPLong ||entry instanceof CPDouble)
+ entries.add(entry); //these get 2 slots because of their size
+ }
+ } else {
+ if (!others.contains(entry))
+ others.add(entry);
+ }
+ ClassFileEntry[] nestedEntries = entry.getNestedClassFileEntries();
+ for (int i = 0; i < nestedEntries.length; i++) {
+ add(nestedEntries[i]);
+ }
+ return entry;
+ }
+
+ public int indexOf(ClassFileEntry entry) {
+ if (!resolved)
+ throw new IllegalStateException("Constant pool is not yet resolved; this does not make any sense");
+ return entries.indexOf(entry) + 1;
+ }
+
+ public int size() {
+ return entries.size();
+ }
+
+ public ClassFileEntry get(int i) {
+ if (!resolved)
+ throw new IllegalStateException("Constant pool is not yet resolved; this does not make any sense");
+ return (ClassFileEntry) entries.get(--i);
+ }
+
+ public void resolve() {
+ resolved= true;
+ Iterator it = entries.iterator();
+ while (it.hasNext()) {
+ ClassFileEntry entry = (ClassFileEntry) it.next();
+ entry.resolve(this);
+ }
+ it = others.iterator();
+ while (it.hasNext()) {
+ ClassFileEntry entry = (ClassFileEntry) it.next();
+ entry.resolve(this);
+ }
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassConstantPool.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java Sat Jan 6 12:16:29 2007
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-//NOTE: Do not extract strings as messages; this code is still a work-in-progress
-//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-
-public class ClassFile {
- public int major;
- public int minor;
- private int magic = 0xCAFEBABE;
- public ClassConstantPool pool = new ClassConstantPool();
- public int accessFlags;
- public int thisClass;
- public int superClass;
- public int[] interfaces;
- public ClassFileEntry[] fields;
- public ClassFileEntry[] methods;
- public Attribute[] attributes;
- public void write(DataOutputStream dos) throws IOException {
- dos.writeInt(magic);
- dos.writeShort(minor);
- dos.writeShort(major);
- dos.writeShort(pool.size()+1);
- for(int i=1;i<=pool.size();i++) {
- ConstantPoolEntry entry;
- (entry = (ConstantPoolEntry)pool.get(i)).doWrite(dos);
- // Doubles and longs take up two spaces in the pool, but only one gets written
- if (entry.getTag() == ConstantPoolEntry.CP_Double || entry.getTag() == ConstantPoolEntry.CP_Long)
- i++;
- };
- dos.writeShort(accessFlags);
- dos.writeShort(thisClass);
- dos.writeShort(superClass);
- dos.writeShort(interfaces.length);
- for(int i=0;i<interfaces.length;i++) {
- dos.writeShort(interfaces[i]);
- }
- dos.writeShort(fields.length);
- for(int i=0;i<fields.length;i++) {
- fields[i].write(dos);
- }
- dos.writeShort(methods.length);
- for(int i=0;i<methods.length;i++) {
- methods[i].write(dos);
- }
- dos.writeShort(attributes.length);
- for(int i=0;i<attributes.length;i++) {
- attributes[i].write(dos);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
+//NOTE: Do not extract strings as messages; this code is still a work-in-progress
+//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+public class ClassFile {
+ public int major;
+ public int minor;
+ private int magic = 0xCAFEBABE;
+ public ClassConstantPool pool = new ClassConstantPool();
+ public int accessFlags;
+ public int thisClass;
+ public int superClass;
+ public int[] interfaces;
+ public ClassFileEntry[] fields;
+ public ClassFileEntry[] methods;
+ public Attribute[] attributes;
+ public void write(DataOutputStream dos) throws IOException {
+ dos.writeInt(magic);
+ dos.writeShort(minor);
+ dos.writeShort(major);
+ dos.writeShort(pool.size()+1);
+ for(int i=1;i<=pool.size();i++) {
+ ConstantPoolEntry entry;
+ (entry = (ConstantPoolEntry)pool.get(i)).doWrite(dos);
+ // Doubles and longs take up two spaces in the pool, but only one gets written
+ if (entry.getTag() == ConstantPoolEntry.CP_Double || entry.getTag() == ConstantPoolEntry.CP_Long)
+ i++;
+ };
+ dos.writeShort(accessFlags);
+ dos.writeShort(thisClass);
+ dos.writeShort(superClass);
+ dos.writeShort(interfaces.length);
+ for(int i=0;i<interfaces.length;i++) {
+ dos.writeShort(interfaces[i]);
+ }
+ dos.writeShort(fields.length);
+ for(int i=0;i<fields.length;i++) {
+ fields[i].write(dos);
+ }
+ dos.writeShort(methods.length);
+ for(int i=0;i<methods.length;i++) {
+ methods[i].write(dos);
+ }
+ dos.writeShort(attributes.length);
+ for(int i=0;i<attributes.length;i++) {
+ attributes[i].write(dos);
+ }
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java Sat Jan 6 12:16:29 2007
@@ -1,57 +1,57 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-// NOTE: Do not extract strings as messages; this code is still a
-// work-in-progress
-// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-public abstract class ClassFileEntry {
- private static final ClassFileEntry[] NONE = new ClassFileEntry[0];
- private boolean resolved;
-
- public abstract boolean equals(Object arg0);
-
- protected ClassFileEntry[] getNestedClassFileEntries() {
- return NONE;
- }
-
- public abstract int hashCode();
-
- /**
- * Allows the constant pool entries to resolve their nested entries
- *
- * @param pool
- */
- protected void resolve(ClassConstantPool pool) {
- resolved = true;
- }
-
- public abstract String toString();
-
- public final void write(DataOutputStream dos) throws IOException {
- if(!resolved)
- throw new IllegalStateException("Entry has not been resolved");
- doWrite(dos);
- }
-
- protected abstract void doWrite(DataOutputStream dos) throws IOException;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
+// NOTE: Do not extract strings as messages; this code is still a
+// work-in-progress
+// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public abstract class ClassFileEntry {
+ private static final ClassFileEntry[] NONE = new ClassFileEntry[0];
+ private boolean resolved;
+
+ public abstract boolean equals(Object arg0);
+
+ protected ClassFileEntry[] getNestedClassFileEntries() {
+ return NONE;
+ }
+
+ public abstract int hashCode();
+
+ /**
+ * Allows the constant pool entries to resolve their nested entries
+ *
+ * @param pool
+ */
+ protected void resolve(ClassConstantPool pool) {
+ resolved = true;
+ }
+
+ public abstract String toString();
+
+ public final void write(DataOutputStream dos) throws IOException {
+ if(!resolved)
+ throw new IllegalStateException("Entry has not been resolved");
+ doWrite(dos);
+ }
+
+ protected abstract void doWrite(DataOutputStream dos) throws IOException;
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ClassFileEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java Sat Jan 6 12:16:29 2007
@@ -1,83 +1,83 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
-// NOTE: Do not extract strings as messages; this code is still a
-// work-in-progress
-// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-
-/**
- * @author alex
- *
- */
-public abstract class ConstantPoolEntry extends ClassFileEntry {
- public static final byte CP_Class = 7;
-
- public static final byte CP_Double = 6;
-
- public static final byte CP_Fieldref = 9;
-
- public static final byte CP_Float = 4;
-
- public static final byte CP_Integer = 3;
-
- /*
- * class MemberRef extends ConstantPoolEntry { private int index;
- *
- * Class(String name) { super(CP_Class); index = pool.indexOf(name); }
- *
- * void writeBody(DataOutputStream dos) throws IOException {
- * dos.writeShort(index); } }
- */
-
- public static final byte CP_InterfaceMethodref = 11;
-
- public static final byte CP_Long = 5;
-
- public static final byte CP_Methodref = 10;
-
- public static final byte CP_NameAndType = 12;
-
- public static final byte CP_String = 8;
-
- public static final byte CP_UTF8 = 1;
-
- byte tag;
-
- ConstantPoolEntry(byte tag) {
- this.tag = tag;
- }
-
- public abstract boolean equals(Object obj);
-
- public byte getTag() {
- return tag;
- }
-
- public abstract int hashCode();
-
- public void doWrite(DataOutputStream dos) throws IOException {
- dos.writeByte(tag);
- writeBody(dos);
- }
-
- protected abstract void writeBody(DataOutputStream dos) throws IOException;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
+// NOTE: Do not extract strings as messages; this code is still a
+// work-in-progress
+// NOTE: Also, don't get rid of 'else' statements for the hell of it ...
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+/**
+ * @author alex
+ *
+ */
+public abstract class ConstantPoolEntry extends ClassFileEntry {
+ public static final byte CP_Class = 7;
+
+ public static final byte CP_Double = 6;
+
+ public static final byte CP_Fieldref = 9;
+
+ public static final byte CP_Float = 4;
+
+ public static final byte CP_Integer = 3;
+
+ /*
+ * class MemberRef extends ConstantPoolEntry { private int index;
+ *
+ * Class(String name) { super(CP_Class); index = pool.indexOf(name); }
+ *
+ * void writeBody(DataOutputStream dos) throws IOException {
+ * dos.writeShort(index); } }
+ */
+
+ public static final byte CP_InterfaceMethodref = 11;
+
+ public static final byte CP_Long = 5;
+
+ public static final byte CP_Methodref = 10;
+
+ public static final byte CP_NameAndType = 12;
+
+ public static final byte CP_String = 8;
+
+ public static final byte CP_UTF8 = 1;
+
+ byte tag;
+
+ ConstantPoolEntry(byte tag) {
+ this.tag = tag;
+ }
+
+ public abstract boolean equals(Object obj);
+
+ public byte getTag() {
+ return tag;
+ }
+
+ public abstract int hashCode();
+
+ public void doWrite(DataOutputStream dos) throws IOException {
+ dos.writeByte(tag);
+ writeBody(dos);
+ }
+
+ protected abstract void writeBody(DataOutputStream dos) throws IOException;
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantPoolEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java Sat Jan 6 12:16:29 2007
@@ -1,93 +1,93 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-public class ConstantValueAttribute extends Attribute {
- private int constantIndex;
-
- private ClassFileEntry entry;
-
- public ConstantValueAttribute(Object value) {
- super("ConstantValue"); //$NON-NLS-1$
- if (value instanceof java.lang.Integer) {
- this.entry = new CPInteger((Integer) value);
- } else if (value instanceof java.lang.Long) {
- this.entry = new CPLong((Long) value);
- } else if (value instanceof java.lang.Float) {
- this.entry = new CPFloat((Float) value);
- } else if (value instanceof java.lang.Double) {
- this.entry = new CPDouble((Double) value);
- } else if (value instanceof java.lang.String) {
- this.entry = new CPString((String) value);
- } else {
- throw new Error("Oops, I've not done it again");
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (this.getClass() != obj.getClass())
- return false;
- final ConstantValueAttribute other = (ConstantValueAttribute) obj;
- if (entry == null) {
- if (other.entry != null)
- return false;
- } else if (!entry.equals(other.entry))
- return false;
- return true;
- }
-
- @Override
- protected int getLength() {
- return 2;
- }
-
- protected ClassFileEntry[] getNestedClassFileEntries() {
- return new ClassFileEntry[] { getAttributeName(), entry };
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = super.hashCode();
- result = PRIME * result + ((entry == null) ? 0 : entry.hashCode());
- return result;
- }
-
- protected void resolve(ClassConstantPool pool) {
- super.resolve(pool);
- entry.resolve(pool);
- this.constantIndex = pool.indexOf(entry);
- }
-
- public String toString() {
- return "Constant:" + entry;
- }
-
- @Override
- protected void writeBody(DataOutputStream dos) throws IOException {
- dos.writeShort(constantIndex);
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public class ConstantValueAttribute extends Attribute {
+ private int constantIndex;
+
+ private ClassFileEntry entry;
+
+ public ConstantValueAttribute(Object value) {
+ super("ConstantValue"); //$NON-NLS-1$
+ if (value instanceof java.lang.Integer) {
+ this.entry = new CPInteger((Integer) value);
+ } else if (value instanceof java.lang.Long) {
+ this.entry = new CPLong((Long) value);
+ } else if (value instanceof java.lang.Float) {
+ this.entry = new CPFloat((Float) value);
+ } else if (value instanceof java.lang.Double) {
+ this.entry = new CPDouble((Double) value);
+ } else if (value instanceof java.lang.String) {
+ this.entry = new CPString((String) value);
+ } else {
+ throw new Error("Oops, I've not done it again");
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (this.getClass() != obj.getClass())
+ return false;
+ final ConstantValueAttribute other = (ConstantValueAttribute) obj;
+ if (entry == null) {
+ if (other.entry != null)
+ return false;
+ } else if (!entry.equals(other.entry))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected int getLength() {
+ return 2;
+ }
+
+ protected ClassFileEntry[] getNestedClassFileEntries() {
+ return new ClassFileEntry[] { getAttributeName(), entry };
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = super.hashCode();
+ result = PRIME * result + ((entry == null) ? 0 : entry.hashCode());
+ return result;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ entry.resolve(pool);
+ this.constantIndex = pool.indexOf(entry);
+ }
+
+ public String toString() {
+ return "Constant:" + entry;
+ }
+
+ @Override
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(constantIndex);
+ }
+
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ConstantValueAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java Sat Jan 6 12:16:29 2007
@@ -1,91 +1,91 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-
-public class ExceptionsAttribute extends Attribute {
-
- private transient int[] exceptionIndexes;
-
- private CPClass[] exceptions;
-
- public ExceptionsAttribute(CPClass[] exceptions) {
- super("Exceptions"); //$NON-NLS-1$
- this.exceptions = exceptions;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ExceptionsAttribute other = (ExceptionsAttribute) obj;
- if (!Arrays.equals(exceptions, other.exceptions))
- return false;
- return true;
- }
-
- @Override
- protected int getLength() {
- return 2 + 2 * exceptions.length;
- }
-
- protected ClassFileEntry[] getNestedClassFileEntries() {
- ClassFileEntry[] result = new ClassFileEntry[exceptions.length+1];
- for (int i = 0; i < exceptions.length; i++) {
- result[i] = exceptions[i];
- }
- result[exceptions.length] = getAttributeName();
- return result;
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = super.hashCode();
- result = PRIME * result + Arrays.hashCode(exceptions);
- return result;
- }
-
- protected void resolve(ClassConstantPool pool) {
- super.resolve(pool);
- exceptionIndexes = new int[exceptions.length];
- for (int i = 0; i < exceptions.length; i++) {
- exceptions[i].resolve(pool);
- exceptionIndexes[i] = pool.indexOf(exceptions[i]);
- }
- }
-
- public String toString() {
- return "Exceptions:" + exceptions;
- }
-
- @Override
- protected void writeBody(DataOutputStream dos) throws IOException {
- dos.writeShort(exceptionIndexes.length);
- for (int i = 0; i < exceptionIndexes.length; i++) {
- dos.writeShort(exceptionIndexes[i]);
- }
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+public class ExceptionsAttribute extends Attribute {
+
+ private transient int[] exceptionIndexes;
+
+ private CPClass[] exceptions;
+
+ public ExceptionsAttribute(CPClass[] exceptions) {
+ super("Exceptions"); //$NON-NLS-1$
+ this.exceptions = exceptions;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final ExceptionsAttribute other = (ExceptionsAttribute) obj;
+ if (!Arrays.equals(exceptions, other.exceptions))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected int getLength() {
+ return 2 + 2 * exceptions.length;
+ }
+
+ protected ClassFileEntry[] getNestedClassFileEntries() {
+ ClassFileEntry[] result = new ClassFileEntry[exceptions.length+1];
+ for (int i = 0; i < exceptions.length; i++) {
+ result[i] = exceptions[i];
+ }
+ result[exceptions.length] = getAttributeName();
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = super.hashCode();
+ result = PRIME * result + Arrays.hashCode(exceptions);
+ return result;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ exceptionIndexes = new int[exceptions.length];
+ for (int i = 0; i < exceptions.length; i++) {
+ exceptions[i].resolve(pool);
+ exceptionIndexes[i] = pool.indexOf(exceptions[i]);
+ }
+ }
+
+ public String toString() {
+ return "Exceptions:" + exceptions;
+ }
+
+ @Override
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(exceptionIndexes.length);
+ for (int i = 0; i < exceptionIndexes.length; i++) {
+ dos.writeShort(exceptionIndexes[i]);
+ }
+ }
+
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/ExceptionsAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java Sat Jan 6 12:16:29 2007
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.archive.internal.pack200.bytecode;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-
-public class SourceFileAttribute extends Attribute {
- private CPUTF8 name;
-
- private int nameIndex;
-
- public SourceFileAttribute(String name) {
- super("SourceFile"); //$NON-NLS-1$
- this.name = new CPUTF8(name);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (this.getClass() != obj.getClass())
- return false;
- final SourceFileAttribute other = (SourceFileAttribute) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
- @Override
- protected int getLength() {
- return 2;
- }
-
- protected ClassFileEntry[] getNestedClassFileEntries() {
- return new ClassFileEntry[] { getAttributeName(), name };
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = super.hashCode();
- result = PRIME * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- protected void resolve(ClassConstantPool pool) {
- super.resolve(pool);
- nameIndex = pool.indexOf(name);
- }
-
- public String toString() {
- return "SourceFile: " + name;
- }
-
- protected void writeBody(DataOutputStream dos) throws IOException {
- dos.writeShort(nameIndex);
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.bytecode;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+
+public class SourceFileAttribute extends Attribute {
+ private CPUTF8 name;
+
+ private int nameIndex;
+
+ public SourceFileAttribute(String name) {
+ super("SourceFile"); //$NON-NLS-1$
+ this.name = new CPUTF8(name);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (this.getClass() != obj.getClass())
+ return false;
+ final SourceFileAttribute other = (SourceFileAttribute) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected int getLength() {
+ return 2;
+ }
+
+ protected ClassFileEntry[] getNestedClassFileEntries() {
+ return new ClassFileEntry[] { getAttributeName(), name };
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = super.hashCode();
+ result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ protected void resolve(ClassConstantPool pool) {
+ super.resolve(pool);
+ nameIndex = pool.indexOf(name);
+ }
+
+ public String toString() {
+ return "SourceFile: " + name;
+ }
+
+ protected void writeBody(DataOutputStream dos) throws IOException {
+ dos.writeShort(nameIndex);
+ }
}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/bytecode/SourceFileAttribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutMapTest.java Sat Jan 6 12:16:29 2007
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.AttributeLayout;
-import org.apache.harmony.archive.internal.pack200.AttributeLayoutMap;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
+import org.apache.harmony.pack200.AttributeLayout;
+import org.apache.harmony.pack200.AttributeLayoutMap;
+import org.apache.harmony.pack200.Pack200Exception;
public class AttributeLayoutMapTest extends TestCase {
public void testRepeatable() throws Pack200Exception {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/AttributeLayoutTest.java Sat Jan 6 12:16:29 2007
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.AttributeLayout;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
-import org.apache.harmony.archive.internal.pack200.Segment;
+import org.apache.harmony.pack200.AttributeLayout;
+import org.apache.harmony.pack200.Pack200Exception;
+import org.apache.harmony.pack200.Segment;
public class AttributeLayoutTest extends TestCase {
public class TestSegment extends Segment {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java Sat Jan 6 12:16:29 2007
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
@@ -25,10 +25,10 @@
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.BHSDCodec;
-import org.apache.harmony.archive.internal.pack200.Codec;
-import org.apache.harmony.archive.internal.pack200.CodecEncoding;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
+import org.apache.harmony.pack200.BHSDCodec;
+import org.apache.harmony.pack200.Codec;
+import org.apache.harmony.pack200.CodecEncoding;
+import org.apache.harmony.pack200.Pack200Exception;
/**
* @author Alex Blewitt
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java Sat Jan 6 12:16:29 2007
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
@@ -24,10 +24,10 @@
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.BHSDCodec;
-import org.apache.harmony.archive.internal.pack200.Codec;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
-import org.apache.harmony.archive.internal.pack200.RunCodec;
+import org.apache.harmony.pack200.BHSDCodec;
+import org.apache.harmony.pack200.Codec;
+import org.apache.harmony.pack200.Pack200Exception;
+import org.apache.harmony.pack200.RunCodec;
/**
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/HelloWorld.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/HelloWorld.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/HelloWorld.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/HelloWorld.java Sat Jan 6 12:16:29 2007
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java Sat Jan 6 12:16:29 2007
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
@@ -24,9 +24,9 @@
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.Codec;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
-import org.apache.harmony.archive.internal.pack200.PopulationCodec;
+import org.apache.harmony.pack200.Codec;
+import org.apache.harmony.pack200.Pack200Exception;
+import org.apache.harmony.pack200.PopulationCodec;
public class PopulationCodecTest extends TestCase {
public void testPopulationCodec() throws IOException, Pack200Exception {
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java Sat Jan 6 12:16:29 2007
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
import junit.framework.TestCase;
-import org.apache.harmony.archive.internal.pack200.Pack200Exception;
-import org.apache.harmony.archive.internal.pack200.SegmentOptions;
+import org.apache.harmony.pack200.Pack200Exception;
+import org.apache.harmony.pack200.SegmentOptions;
/**
* @author Alex Blewitt
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java Sat Jan 6 12:16:29 2007
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.harmony.archive.tests.internal.pack200;
+package org.apache.harmony.pack200.tests;
//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5
//NOTE: Do not extract strings as messages; this code is still a work-in-progress
//NOTE: Also, don't get rid of 'else' statements for the hell of it ...
-import org.apache.harmony.archive.internal.pack200.Segment;
+import org.apache.harmony.pack200.Segment;
import junit.framework.TestCase;
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java Sat Jan 6 12:16:29 2007
@@ -1,75 +1,91 @@
-package org.apache.harmony.archive.tests.internal.pack200.bytecode;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.archive.internal.pack200.bytecode.CPDouble;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPFloat;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPInteger;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPLong;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPMember;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPString;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPUTF8;
-import org.apache.harmony.archive.internal.pack200.bytecode.SourceFileAttribute;
-
-public class ClassFileEntryTest extends TestCase {
- public void testUTF8() {
- CPUTF8 u1 = new CPUTF8(new String("thing")); //$NON-NLS-1$
- CPUTF8 u2 = new CPUTF8(new String("thing")); //$NON-NLS-1$
- CPUTF8 u3 = new CPUTF8(new String("otherthing")); //$NON-NLS-1$
- checkEquality(u1, u2, "thing", u3);
- }
- private void checkEquality(Object equal1, Object equal2, String toString, Object unequal) {
- assertEquals(equal1,equal2);
- assertEquals(equal1.hashCode(),equal2.hashCode());
- assertTrue(equal1.toString().indexOf(toString)>=0); //$NON-NLS-1$
- assertFalse(equal1.equals(unequal));
- assertFalse(equal2.equals(unequal));
- assertFalse(unequal.equals(equal1));
- assertFalse(unequal.equals(equal2));
- }
- public void testSourceAttribute() {
- SourceFileAttribute sfa1 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
- SourceFileAttribute sfa2 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
- SourceFileAttribute sfa3 = new SourceFileAttribute(new String("OtherThing.java")); //$NON-NLS-1$
- checkEquality(sfa1,sfa2,"Thing.java",sfa3); //$NON-NLS-1$
- }
- public void testCPInteger() {
- CPInteger cp1 = new CPInteger(new Integer(3));
- CPInteger cp2 = new CPInteger(new Integer(3));
- CPInteger cp3 = new CPInteger(new Integer(5));
- checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
- }
- public void testCPLong() {
- CPLong cp1 = new CPLong(new Long(3));
- CPLong cp2 = new CPLong(new Long(3));
- CPLong cp3 = new CPLong(new Long(5));
- checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
- }
- public void testCPDouble() {
- CPDouble cp1 = new CPDouble(new Double(3));
- CPDouble cp2 = new CPDouble(new Double(3));
- CPDouble cp3 = new CPDouble(new Double(5));
- checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
- }
- public void testCPFloat() {
- CPFloat cp1 = new CPFloat(new Float(3));
- CPFloat cp2 = new CPFloat(new Float(3));
- CPFloat cp3 = new CPFloat(new Float(5));
- checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
- }
- public void testCPString() {
- CPString cp1 = new CPString(new String("3"));
- CPString cp2 = new CPString(new String("3"));
- CPString cp3 = new CPString(new String("5"));
- checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
- }
- public void testCPField() {
- CPMember cp1 = new CPMember("Name:I", 0, null);
- CPMember cp2 = new CPMember("Name:I", 0, null);
- CPMember cp3 = new CPMember("Name:Z", 0, null);
- CPMember cp4 = new CPMember("GName:I", 0, null);
- checkEquality(cp1,cp2,"Name",cp3); //$NON-NLS-1$
- checkEquality(cp1,cp2,"I",cp4); //$NON-NLS-1$
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.tests.bytecode;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.pack200.bytecode.CPDouble;
+import org.apache.harmony.pack200.bytecode.CPFloat;
+import org.apache.harmony.pack200.bytecode.CPInteger;
+import org.apache.harmony.pack200.bytecode.CPLong;
+import org.apache.harmony.pack200.bytecode.CPMember;
+import org.apache.harmony.pack200.bytecode.CPString;
+import org.apache.harmony.pack200.bytecode.CPUTF8;
+import org.apache.harmony.pack200.bytecode.SourceFileAttribute;
+
+public class ClassFileEntryTest extends TestCase {
+ public void testUTF8() {
+ CPUTF8 u1 = new CPUTF8(new String("thing")); //$NON-NLS-1$
+ CPUTF8 u2 = new CPUTF8(new String("thing")); //$NON-NLS-1$
+ CPUTF8 u3 = new CPUTF8(new String("otherthing")); //$NON-NLS-1$
+ checkEquality(u1, u2, "thing", u3);
+ }
+ private void checkEquality(Object equal1, Object equal2, String toString, Object unequal) {
+ assertEquals(equal1,equal2);
+ assertEquals(equal1.hashCode(),equal2.hashCode());
+ assertTrue(equal1.toString().indexOf(toString)>=0); //$NON-NLS-1$
+ assertFalse(equal1.equals(unequal));
+ assertFalse(equal2.equals(unequal));
+ assertFalse(unequal.equals(equal1));
+ assertFalse(unequal.equals(equal2));
+ }
+ public void testSourceAttribute() {
+ SourceFileAttribute sfa1 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
+ SourceFileAttribute sfa2 = new SourceFileAttribute(new String("Thing.java")); //$NON-NLS-1$
+ SourceFileAttribute sfa3 = new SourceFileAttribute(new String("OtherThing.java")); //$NON-NLS-1$
+ checkEquality(sfa1,sfa2,"Thing.java",sfa3); //$NON-NLS-1$
+ }
+ public void testCPInteger() {
+ CPInteger cp1 = new CPInteger(new Integer(3));
+ CPInteger cp2 = new CPInteger(new Integer(3));
+ CPInteger cp3 = new CPInteger(new Integer(5));
+ checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
+ }
+ public void testCPLong() {
+ CPLong cp1 = new CPLong(new Long(3));
+ CPLong cp2 = new CPLong(new Long(3));
+ CPLong cp3 = new CPLong(new Long(5));
+ checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
+ }
+ public void testCPDouble() {
+ CPDouble cp1 = new CPDouble(new Double(3));
+ CPDouble cp2 = new CPDouble(new Double(3));
+ CPDouble cp3 = new CPDouble(new Double(5));
+ checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
+ }
+ public void testCPFloat() {
+ CPFloat cp1 = new CPFloat(new Float(3));
+ CPFloat cp2 = new CPFloat(new Float(3));
+ CPFloat cp3 = new CPFloat(new Float(5));
+ checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
+ }
+ public void testCPString() {
+ CPString cp1 = new CPString(new String("3"));
+ CPString cp2 = new CPString(new String("3"));
+ CPString cp3 = new CPString(new String("5"));
+ checkEquality(cp1,cp2,"3",cp3); //$NON-NLS-1$
+ }
+ public void testCPField() {
+ CPMember cp1 = new CPMember("Name:I", 0, null);
+ CPMember cp2 = new CPMember("Name:I", 0, null);
+ CPMember cp3 = new CPMember("Name:Z", 0, null);
+ CPMember cp4 = new CPMember("GName:I", 0, null);
+ checkEquality(cp1,cp2,"Name",cp3); //$NON-NLS-1$
+ checkEquality(cp1,cp2,"I",cp4); //$NON-NLS-1$
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java?view=diff&rev=493560&r1=493559&r2=493560
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java Sat Jan 6 12:16:29 2007
@@ -1,37 +1,53 @@
-package org.apache.harmony.archive.tests.internal.pack200.bytecode;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.archive.internal.pack200.bytecode.CPMember;
-import org.apache.harmony.archive.internal.pack200.bytecode.CPUTF8;
-import org.apache.harmony.archive.internal.pack200.bytecode.ClassConstantPool;
-
-public class ConstantPoolTest extends TestCase {
- private ClassConstantPool pool;
-
- public void setUp() {
- pool = new ClassConstantPool();
- }
- public void testDuplicateUTF8() {
- CPUTF8 u1 = new CPUTF8("thing");
- CPUTF8 u2 = new CPUTF8("thing");
- pool.add(u1);
- pool.add(u2);
- assertEquals(1,pool.size());
- }
- public void testDuplicateField() {
- CPMember cp1 = new CPMember("name:I",0,null);
- pool.add(cp1);
- assertEquals(2,pool.size());
- CPMember cp2 = new CPMember("name:I",0,null);
- pool.add(cp2);
- assertEquals(2,pool.size());
- }
- public void testIndex() {
- pool.add(new CPUTF8("OtherThing"));
- CPUTF8 u1 = new CPUTF8("thing");
- pool.add(u1);
- pool.resolve();
- assertTrue(pool.indexOf(u1) > 0);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200.tests.bytecode;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.pack200.bytecode.CPMember;
+import org.apache.harmony.pack200.bytecode.CPUTF8;
+import org.apache.harmony.pack200.bytecode.ClassConstantPool;
+
+public class ConstantPoolTest extends TestCase {
+ private ClassConstantPool pool;
+
+ public void setUp() {
+ pool = new ClassConstantPool();
+ }
+ public void testDuplicateUTF8() {
+ CPUTF8 u1 = new CPUTF8("thing");
+ CPUTF8 u2 = new CPUTF8("thing");
+ pool.add(u1);
+ pool.add(u2);
+ assertEquals(1,pool.size());
+ }
+ public void testDuplicateField() {
+ CPMember cp1 = new CPMember("name:I",0,null);
+ pool.add(cp1);
+ assertEquals(2,pool.size());
+ CPMember cp2 = new CPMember("name:I",0,null);
+ pool.add(cp2);
+ assertEquals(2,pool.size());
+ }
+ public void testIndex() {
+ pool.add(new CPUTF8("OtherThing"));
+ CPUTF8 u1 = new CPUTF8("thing");
+ pool.add(u1);
+ pool.resolve();
+ assertTrue(pool.indexOf(u1) > 0);
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ConstantPoolTest.java
------------------------------------------------------------------------------
svn:eol-style = native