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).

!include once #1019934 // BCEL

static org.apache.bcel.generic.Type classToBCELType(Class c) {
  delegate Type to org.apache.bcel.generic.
  
  if (c == null) null;
  if (isPrimitiveType(c)) {
    if (c == byte.class) ret Type.BYTE;
    if (c == char.class) ret Type.CHAR;
    if (c == short.class) ret Type.SHORT;
    if (c == int.class) ret Type.INT;
    if (c == long.class) ret Type.LONG;
    if (c == double.class) ret Type.DOUBLE;
    if (c == void.class) ret Type.VOID;
    if (c == bool.class) ret Type.BOOLEAN;
    fail("TODO: classToBCELType " + c);
  }
  if (isArrayType(c)) {
    int dimensions = 0;
    while (c.isArray()) {
      ++dimensions;
      c = c.componentType();
    }
    ret new ArrayType(classToBCELType(c), dimensions);
  }
  ret new ObjectType(className(c));
}

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: 179 / 261
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1035317 - typeToBCELType