src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
3 */ |
3 */ |
4 /* |
4 /* |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * contributor license agreements. See the NOTICE file distributed with |
6 * contributor license agreements. See the NOTICE file distributed with |
7 * this work for additional information regarding copyright ownership. |
7 * this work for additional information regarding copyright ownership. |
37 * of different classpaths, and as such It is designed to be used as a singleton |
37 * of different classpaths, and as such It is designed to be used as a singleton |
38 * per classpath. |
38 * per classpath. |
39 * |
39 * |
40 * @see com.sun.org.apache.bcel.internal.Repository |
40 * @see com.sun.org.apache.bcel.internal.Repository |
41 * |
41 * |
42 * @version $Id: SyntheticRepository.java 1748124 2016-06-13 08:02:16Z ggregory |
42 * @version $Id$ |
43 * $ |
43 * @LastModified: Jun 2019 |
44 */ |
44 */ |
45 public class SyntheticRepository implements Repository { |
45 public class SyntheticRepository implements Repository { |
46 |
46 |
47 // CLASSNAME X JAVACLASS |
47 // CLASSNAME X JAVACLASS |
48 private final Map<String, SoftReference<JavaClass>> loadedClasses = new HashMap<>(); |
48 private final Map<String, SoftReference<JavaClass>> loadedClasses = new HashMap<>(); |
77 @Override |
77 @Override |
78 public JavaClass findClass(final String className) { |
78 public JavaClass findClass(final String className) { |
79 final SoftReference<JavaClass> ref = loadedClasses.get(className); |
79 final SoftReference<JavaClass> ref = loadedClasses.get(className); |
80 if (ref == null) { |
80 if (ref == null) { |
81 return null; |
81 return null; |
82 } |
82 } |
83 return ref.get(); |
83 return ref.get(); |
84 } |
84 } |
85 |
85 |
86 /** |
86 /** |
87 * Finds a JavaClass object by name. If it is already in this Repository, the |
87 * Finds a JavaClass object by name. If it is already in this Repository, the |