Class ConstantUtils

java.lang.Object
org.glavo.classfile.constant.ConstantUtils

public class ConstantUtils extends Object
Helper methods for the implementation of java.lang.constant.
  • Field Details

    • INIT_NAME

      public static final String INIT_NAME
      The special name of instance initialization methods, "<init>". An instance initialization method has this special name and is void.
      Since:
      21
      See Also:
      Jvms:
      2.9.1 Instance Initialization Methods
    • CLASS_INIT_NAME

      public static final String CLASS_INIT_NAME
      The special name of class initialization methods, "<clinit>". A class initialization method has this special name, ACC_STATIC flag set, is void and takes no arguments.
      Since:
      21
      See Also:
      Jvms:
      2.9.2 Class Initialization Methods
    • MTD_void

      public static final MethodTypeDesc MTD_void
      Nominal descriptor representing the method descriptor ()V, taking no argument and returning void.
      Since:
      21
    • EMPTY_CONSTANTDESC

      public static final ConstantDesc[] EMPTY_CONSTANTDESC
      an empty constant descriptor
  • Constructor Details

    • ConstantUtils

      public ConstantUtils()
  • Method Details

    • validateBinaryPackageName

      public static String validateBinaryPackageName(String name)
      Validates the correctness of a binary package name. In particular checks for the presence of invalid characters in the name. Empty package name is allowed.
      Parameters:
      name - the package name
      Returns:
      the package name passed if valid
      Throws:
      IllegalArgumentException - if the package name is invalid
      NullPointerException - if the package name is null
    • validateInternalPackageName

      public static String validateInternalPackageName(String name)
      Validates the correctness of an internal package name. In particular checks for the presence of invalid characters in the name. Empty package name is allowed.
      Parameters:
      name - the package name
      Returns:
      the package name passed if valid
      Throws:
      IllegalArgumentException - if the package name is invalid
      NullPointerException - if the package name is null
    • validateModuleName

      public static String validateModuleName(String name)
      Validates the correctness of a module name. In particular checks for the presence of invalid characters in the name. Empty module name is allowed. Module and Package Names
      Parameters:
      name - the module name
      Returns:
      the module name passed if valid
      Throws:
      IllegalArgumentException - if the module name is invalid
      NullPointerException - if the module name is null
    • validateMemberName

      public static String validateMemberName(String name, boolean method)
      Validates a member name
      Parameters:
      name - the name of the member
      Returns:
      the name passed if valid
      Throws:
      IllegalArgumentException - if the member name is invalid