langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java
equal
deleted
inserted
replaced
30 import java.util.List; |
30 import java.util.List; |
31 import java.util.Map; |
31 import java.util.Map; |
32 import java.util.concurrent.ConcurrentHashMap; |
32 import java.util.concurrent.ConcurrentHashMap; |
33 |
33 |
34 import com.sun.tools.javac.util.Context; |
34 import com.sun.tools.javac.util.Context; |
|
35 import com.sun.tools.javac.util.Context.Factory; |
35 |
36 |
36 /** |
37 /** |
37 * Caching implementation of FSInfo. |
38 * Caching implementation of FSInfo. |
38 * |
39 * |
39 * <p><b>This is NOT part of any supported API. |
40 * <p><b>This is NOT part of any supported API. |
45 |
46 |
46 /** |
47 /** |
47 * Register a Context.Factory to create a CacheFSInfo. |
48 * Register a Context.Factory to create a CacheFSInfo. |
48 */ |
49 */ |
49 public static void preRegister(Context context) { |
50 public static void preRegister(Context context) { |
50 context.put(FSInfo.class, new Context.Factory<FSInfo>() { |
51 context.put(FSInfo.class, (Factory<FSInfo>)c -> { |
51 public FSInfo make(Context c) { |
|
52 FSInfo instance = new CacheFSInfo(); |
52 FSInfo instance = new CacheFSInfo(); |
53 c.put(FSInfo.class, instance); |
53 c.put(FSInfo.class, instance); |
54 return instance; |
54 return instance; |
55 } |
55 }); |
56 }); |
|
57 } |
56 } |
58 |
57 |
59 public void clearCache() { |
58 public void clearCache() { |
60 cache.clear(); |
59 cache.clear(); |
61 } |
60 } |