1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
3 * @LastModified: Oct 2017 |
4 */ |
4 */ |
5 /* |
5 /* |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
8 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
29 import com.sun.org.apache.bcel.internal.generic.IFNULL; |
29 import com.sun.org.apache.bcel.internal.generic.IFNULL; |
30 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; |
30 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; |
31 import com.sun.org.apache.bcel.internal.generic.Instruction; |
31 import com.sun.org.apache.bcel.internal.generic.Instruction; |
32 import com.sun.org.apache.bcel.internal.generic.InstructionList; |
32 import com.sun.org.apache.bcel.internal.generic.InstructionList; |
33 import com.sun.org.apache.bcel.internal.generic.PUSH; |
33 import com.sun.org.apache.bcel.internal.generic.PUSH; |
|
34 import com.sun.org.apache.xalan.internal.utils.ObjectFactory; |
34 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; |
35 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; |
35 import com.sun.org.apache.xalan.internal.utils.ObjectFactory; |
|
36 |
36 |
37 /** |
37 /** |
38 * @author Todd Miller |
38 * @author Todd Miller |
39 * @author Santiago Pericas-Geertsen |
39 * @author Santiago Pericas-Geertsen |
40 */ |
40 */ |
41 public final class ObjectType extends Type { |
41 public final class ObjectType extends Type { |
42 |
42 |
43 private String _javaClassName = "java.lang.Object"; |
43 private String _javaClassName = "java.lang.Object"; |
44 private Class _clazz = java.lang.Object.class; |
44 private Class<?> _clazz = java.lang.Object.class; |
45 |
45 |
46 /** |
46 /** |
47 * Used to represent a Java Class type such is required to support |
47 * Used to represent a Java Class type such is required to support |
48 * non-static java functions. |
48 * non-static java functions. |
49 * @param javaClassName name of the class such as 'com.foo.Processor' |
49 * @param javaClassName name of the class such as 'com.foo.Processor' |
78 |
78 |
79 public String getJavaClassName() { |
79 public String getJavaClassName() { |
80 return _javaClassName; |
80 return _javaClassName; |
81 } |
81 } |
82 |
82 |
83 public Class getJavaClass() { |
83 public Class<?> getJavaClass() { |
84 return _clazz; |
84 return _clazz; |
85 } |
85 } |
86 |
86 |
87 public String toString() { |
87 public String toString() { |
88 return _javaClassName; |
88 return _javaClassName; |
147 * Translates an object of this type to the external (Java) type denoted |
147 * Translates an object of this type to the external (Java) type denoted |
148 * by <code>clazz</code>. This method is used to translate parameters |
148 * by <code>clazz</code>. This method is used to translate parameters |
149 * when external functions are called. |
149 * when external functions are called. |
150 */ |
150 */ |
151 public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, |
151 public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, |
152 Class clazz) { |
152 Class<?> clazz) { |
153 if (clazz.isAssignableFrom(_clazz)) |
153 if (clazz.isAssignableFrom(_clazz)) |
154 methodGen.getInstructionList().append(NOP); |
154 methodGen.getInstructionList().append(NOP); |
155 else { |
155 else { |
156 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
156 ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, |
157 toString(), clazz.getClass().toString()); |
157 toString(), clazz.getClass().toString()); |
161 |
161 |
162 /** |
162 /** |
163 * Translates an external Java type into an Object type |
163 * Translates an external Java type into an Object type |
164 */ |
164 */ |
165 public void translateFrom(ClassGenerator classGen, |
165 public void translateFrom(ClassGenerator classGen, |
166 MethodGenerator methodGen, Class clazz) { |
166 MethodGenerator methodGen, Class<?> clazz) { |
167 methodGen.getInstructionList().append(NOP); |
167 methodGen.getInstructionList().append(NOP); |
168 } |
168 } |
169 |
169 |
170 public Instruction LOAD(int slot) { |
170 public Instruction LOAD(int slot) { |
171 return new ALOAD(slot); |
171 return new ALOAD(slot); |