Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1035080 // classToBCELType

JavaX fragment (include) [tags: use-pretranspiled]

Uses 679K of libraries. Click here for Pure Java version (9991L/54K).

1  
!include once #1019934 // BCEL
2  
3  
static org.apache.bcel.generic.Type classToBCELType(Class c) {
4  
  delegate Type to org.apache.bcel.generic.
5  
  
6  
  if (c == null) null;
7  
  if (isPrimitiveType(c)) {
8  
    if (c == byte.class) ret Type.BYTE;
9  
    if (c == char.class) ret Type.CHAR;
10  
    if (c == short.class) ret Type.SHORT;
11  
    if (c == int.class) ret Type.INT;
12  
    if (c == long.class) ret Type.LONG;
13  
    if (c == double.class) ret Type.DOUBLE;
14  
    if (c == void.class) ret Type.VOID;
15  
    if (c == bool.class) ret Type.BOOLEAN;
16  
    fail("TODO: classToBCELType " + c);
17  
  }
18  
  if (isArrayType(c)) {
19  
    int dimensions = 0;
20  
    while (c.isArray()) {
21  
      ++dimensions;
22  
      c = c.componentType();
23  
    }
24  
    ret new ArrayType(classToBCELType(c), dimensions);
25  
  }
26  
  ret new ObjectType(className(c));
27  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035080
Snippet name: classToBCELType
Eternal ID of this version: #1035080/5
Text MD5: d61c388b97d46bce4e2155ea57840fb4
Transpilation MD5: 2c1bf9bc057bfca1b1d356b90bc9a0bc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-17 21:28:19
Source code size: 815 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 104 / 168
Version history: 4 change(s)
Referenced in: [show references]