当用jdk8编绎,生成target 为 jdk6/7 的代码时,如果有使用到了类似的代码,就会抛出异常
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
map.keySet();抛出
| package aa; | |
| import java.io.FileDescriptor; | |
| import java.security.Permission; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| public class ArthasSecurityManager extends SecurityManager { |
当用jdk8编绎,生成target 为 jdk6/7 的代码时,如果有使用到了类似的代码,就会抛出异常
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
map.keySet();抛出
| import java.util.Date; | |
| import java.util.Random; | |
| import org.openjdk.jmh.annotations.Benchmark; | |
| import org.openjdk.jmh.annotations.BenchmarkMode; | |
| import org.openjdk.jmh.annotations.Fork; | |
| import org.openjdk.jmh.annotations.Mode; | |
| import org.openjdk.jmh.annotations.Param; | |
| import org.openjdk.jmh.annotations.Scope; |
| import java.lang.annotation.Annotation; | |
| import java.lang.annotation.Documented; | |
| import java.lang.annotation.ElementType; | |
| import java.lang.annotation.Repeatable; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.RetentionPolicy; | |
| import java.util.Arrays; | |
| import abc.Test.AAA; |
| import java.util.concurrent.atomic.AtomicInteger; | |
| public class ThreadId { | |
| // Atomic integer containing the next thread ID to be assigned | |
| private static final AtomicInteger nextId = new AtomicInteger(0); | |
| // Thread local variable containing each thread's ID | |
| private static final ThreadLocal<Integer> threadId = new ThreadLocal<Integer>() { | |
| @Override | |
| protected Integer initialValue() { |
| import java.util.*; | |
| import org.objectweb.asm.*; | |
| public class CDump implements Opcodes { | |
| public static byte[] dump() throws Exception { | |
| ClassWriter cw = new ClassWriter(0); | |
| FieldVisitor fv; | |
| MethodVisitor mv; |
| /** | |
| * | |
| * @author hengyunabc 2017-10-12 | |
| * | |
| */ | |
| public class ClassLoaderUtils { | |
| @SuppressWarnings({ "restriction", "unchecked" }) | |
| public static URL[] getUrls(ClassLoader classLoader) { | |
| if (classLoader instanceof URLClassLoader) { | |
| return ((URLClassLoader) classLoader).getURLs(); |
| import java.lang.management.ManagementFactory; | |
| import java.lang.management.OperatingSystemMXBean; | |
| import com.sun.management.UnixOperatingSystemMXBean; | |
| public class Test { | |
| public static void main(String[] args) { | |
| OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); | |
| if (operatingSystemMXBean instanceof UnixOperatingSystemMXBean) { |
| import java.security.SecureRandom; | |
| public class PenneyGame { | |
| static SecureRandom random = new SecureRandom(); | |
| public static void main(String[] args) { | |
| int count = 100; | |
| int winCount = 0; | |
| for (int i = 0; i < 100; ++i) { |
| import java.util.ArrayList; | |
| import java.util.Stack; | |
| /** | |
| * from org.apache.commons.io.FilenameUtils | |
| * | |
| * @author hengyunabc | |
| * | |
| */ | |
| public class MatchUtils { |