INNER CODE UNIT · Java

remove

anggrayudi/android-hidden-api · cli/BuildJar.java:92

            Set<String> remove = ClosureVerify.soakDangling(nodes);   // internal names
            for (String name : remove) entries.remove(name + ".class");
            System.err.println("[build] pruned " + remove.size() + " dangling class(es) (supertype graph closed)");
        }

        // Stubify (default): replace method bodies with `throw new RuntimeException("Stub!")` so
        // Gradle's MockableJarTransform accepts the jar (issue #46). javac only reads signatures.
        if (!keepBodies) {
            int n = 0;
            for (Map.Entry<String, byte[]> e : entries.entrySet()) {
                if (!e.getKey().endsWith(".class")) continue;
                try { e.setValue(Stubifier.stubify(e.getValue())); n++; }
                catch (Throwable t) { System.err.println("[build] keep-as-is (unstubbable): " + e.getKey()); }
            }
            System.err.println("[build] stubbed " + n + " class(es)");
        } else {
            System.err.println("[build] --keep-bodies: real method bodies kept; Gradle lint/unit tests will FAIL on this jar");
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…