Skip to content

Commit

Permalink
[bughunt] [issue projectlombok#2351] wild-stab try to fix issue 2351,…
Browse files Browse the repository at this point in the history
… without reproduction.
  • Loading branch information
rzwitserloot authored and Febell committed Mar 1, 2020
1 parent d1cefb4 commit be3c2f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2019 The Project Lombok Authors.
* Copyright (C) 2009-2020 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -57,6 +57,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
String[] args = agentArgs == null ? new String[0] : agentArgs.split(":");
boolean forceEcj = false;
boolean forceEclipse = false;

for (String arg : args) {
if (arg.trim().equalsIgnoreCase("ECJ")) forceEcj = true;
if (arg.trim().equalsIgnoreCase("ECLIPSE")) forceEclipse = true;
Expand All @@ -80,6 +81,7 @@ private static void registerPatchScripts(Instrumentation instrumentation, boolea
sm.registerTransformer(instrumentation);
sm.setFilter(new Filter() {
@Override public boolean shouldTransform(ClassLoader loader, String className, Class<?> classBeingDefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
if (loader != null && loader.getClass().toString().startsWith("org.sonar.classloader")) return false; // Relevant to bug #2351
if (!(loader instanceof URLClassLoader)) return true;
ClassLoader parent = loader.getParent();
if (parent == null) return true;
Expand Down

0 comments on commit be3c2f2

Please sign in to comment.