ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
Status
scanned
Type
file
Name
JavaClass.java
Extension
.java
Programming language
Java
Mime type
text/html
File type
HTML document, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
5510 (5.4 KB)
MD5
4b859e035fdc1eeab6772da01a5f9861
SHA1
d4df27a41121dc8cda69304d073206f2a0cd5f93
SHA256
7741743165155de58a5972625928f3cda36aaca742f3b7f5aa9df5dc31e7f254
SHA512

      
    
SHA1_git
3c92425a4462e92535dccd4052cca45ad1ac6b14
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
JavaClass.java | 5.4 KB |

/* * 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.tomcat.util.bcel.classfile; import java.util.HashMap; import java.util.List; /** * Represents a Java class, i.e., the data structures, constant pool, fields, methods and commands contained in a Java * .class file. See <a href="https://docs.oracle.com/javase/specs/">JVM specification</a> for details. The intent of * this class is to represent a parsed or otherwise existing class file. Those interested in programmatically generating * classes should see the <a href="../generic/ClassGen.html">ClassGen</a> class. */ public class JavaClass { private final int accessFlags; private final String className; private final String superclassName; private final String[] interfaceNames; private final Annotations runtimeVisibleAnnotations; // "RuntimeVisibleAnnotations" attribute defined in the class private final List<Annotations> runtimeVisibleFieldOrMethodAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere /** * Constructor gets all contents as arguments. * * @param className Name of this class. * @param superclassName Name of this class's superclass. * @param accessFlags Access rights defined by bit flags * @param constantPool Array of constants * @param interfaceNames Implemented interfaces * @param runtimeVisibleAnnotations "RuntimeVisibleAnnotations" attribute defined on the Class, or null * @param runtimeVisibleFieldOrMethodAnnotations "RuntimeVisibleAnnotations" attribute defined on the fields or methods, or null */ JavaClass(final String className, final String superclassName, final int accessFlags, final ConstantPool constantPool, final String[] interfaceNames, final Annotations runtimeVisibleAnnotations, final List<Annotations> runtimeVisibleFieldOrMethodAnnotations) { this.accessFlags = accessFlags; this.runtimeVisibleAnnotations = runtimeVisibleAnnotations; this.runtimeVisibleFieldOrMethodAnnotations = runtimeVisibleFieldOrMethodAnnotations; this.className = className; this.superclassName = superclassName; this.interfaceNames = interfaceNames; } /** * @return Access flags of the object aka. "modifiers". */ public final int getAccessFlags() { return accessFlags; } /** * Return annotations entries from "RuntimeVisibleAnnotations" attribute on * the class, fields or methods if there is any. * * @return An array of entries or {@code null} */ public AnnotationEntry[] getAllAnnotationEntries() { HashMap<String, AnnotationEntry> annotationEntries = new HashMap<>(); if (runtimeVisibleAnnotations != null) { for (AnnotationEntry annotationEntry : runtimeVisibleAnnotations.getAnnotationEntries()) { annotationEntries.put(annotationEntry.getAnnotationType(), annotationEntry); } } if (runtimeVisibleFieldOrMethodAnnotations != null) { for (Annotations annotations : runtimeVisibleFieldOrMethodAnnotations.toArray(Annotations.EMPTY_ARRAY)) { for (AnnotationEntry annotationEntry : annotations.getAnnotationEntries()) { annotationEntries.putIfAbsent(annotationEntry.getAnnotationType(), annotationEntry); } } } if (annotationEntries.isEmpty()) { return null; } else { return annotationEntries.values().toArray(AnnotationEntry.EMPTY_ARRAY); } } /** * Return annotations entries from "RuntimeVisibleAnnotations" attribute on * the class, if there is any. * * @return An array of entries or {@code null} */ public AnnotationEntry[] getAnnotationEntries() { if (runtimeVisibleAnnotations != null) { return runtimeVisibleAnnotations.getAnnotationEntries(); } return null; } /** * @return Class name. */ public String getClassName() { return className; } /** * @return Names of implemented interfaces. */ public String[] getInterfaceNames() { return interfaceNames; } /** * returns the super class name of this class. In the case that this class is {@link Object}, it will return itself * ({@link Object}). This is probably incorrect but isn't fixed at this time to not break existing clients. * * @return Superclass name. */ public String getSuperclassName() { return superclassName; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
23.56
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9
https://docs.oracle.com/javase/specs/ 24 24