Commit Graph
57 Commits
Author SHA1 Message Date
Jesse Glick e6e8c387d5 Prevent endless recursion in SezpozModule.resolve. 2020-01-04 20:14:13 -05:00
Vincent Latombe dd59e8c11c [JENKINS-60449] Attempt to fix an odd case of OptionalExtension blowing up Jenkins (#4393)
* Add new module optional-depender and a new failing test

* Variant plugin is a dependency of optional-depender

Optional-depender contains the following class

@OptionalExtension(requirePlugins = {"dependee"})
public class OptionalDependerExtension {
      private static void foo(Dependee d) {

      }
}

* [JENKINS-60449] Move plugin initialization at the end, keep only one extension refresh

* Improve logic to detect classloading issues

Inspect all declared constructors/methods/fields recursively to exclude
failing classes from Guice rather than have Guice explode.

This also fix the failing test, but the previous commit is still better
because it avoids an extra Jenkins.get().refreshExtensions() call.

* Only test resolveClass method if the classloader is not the bootstrap one
2020-01-03 23:26:35 +01:00
Basil Crow 861855953b Replace <code>…</code> with {@code …} 2019-10-19 14:02:59 -07:00
Josh Soref 11652016b0 IntelliJ/Java: Duplicate code -- Refactored as ExtensionFinder.getClassFromIndex (#4079)
* IntelliJ/Java: Duplicate code -- Refactored as ExtensionFinder.getClassFromIndex

* Adding braces around throw new AssertionError
2019-06-28 21:59:02 +02:00
Gustavo de Souza Bezerra 0e62b68012 [JENKINS-57678] - Change getInstance() (deprecated) to get() (#4042)
* Change getInstance() (deprecated) to get()

* Reverting modifications according review

* Changing for use the variable
2019-06-27 17:24:45 +02:00
Josh Soref 893e5c0891 Remove unused imports 2019-02-20 20:55:26 -05:00
Nicolas De loof c3988aae8a [JENKINS-52818] support @Postconstruct on extensions (#3570)
* add support for JSR250 @PostConstruct

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* with PostConstruct method no need to explicitely invoke load() anymore

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* introduce PersistentDescriptor to flag Descriptors
which expect load() to be invoked.

This prevent double execution for plugins which
have been designed on previous version of code and
don’t expect load to be automatically invoked.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* document PostConstruct method discovery logic

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* Force reflective access to non-public @PostConstruct methods

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* check @PostConstruct annotation both on method and on implemented interface with a matching method.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>

* typo

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2018-08-18 10:49:44 +02:00
Vincent Latombe 8c1b8b8e14 [JENKINS-50336] Fix loading optional extensions after installing a missing dependency (#3370)
* [JENKINS-50336] Only keep extensions that could be loaded in memory

So that delta computations will re-attempt to load any extension that
previously failed or was skipped after a new plugin is installed.

After installing a plugin, need to refresh extensions in order to pick
up extensions that can be loaded thanks to this new plugin.

* [JENKINS-50336] @OptionalExtension annotated classes were not being picked up after dynamic load of variant

Recompute GuiceExtensionAnnotation list when refreshing extensions
2018-06-08 19:30:11 +02:00
Daniel Beck 1e87a8fddb Reduce logging level of some warnings to INFO 2016-05-02 11:04:34 +02:00
Baptiste Mathus 8b3e4f43a2 Multi-catch refactoring when applicable 2016-04-12 10:17:42 +02:00
Jesse Glick 1a28593f09 [FIXED JENKINS-33772] ID was not sufficiently unique for SezpozModule; use an ID based on the actual annotated element. 2016-03-28 17:31:57 -04:00
Jesse Glick 1a2d82275c [FIXED JENKINS-25440] Recursively resolve @Inject’ed extensions, too, looking for LinkageError’s. 2016-02-29 15:17:05 -05:00
Jesse Glick fe2e448913 Replacing links to bugs.sun.com. 2016-02-16 16:46:38 -05:00
Kohsuke Kawaguchi c1a53a5f21 Formatting simplification for Java7 2015-12-20 10:54:33 -08:00
Christopher Simons 7efb9090dd remove unused import statements
In addition to cluttering the namespace, unused imports generate
compiler warnings, introducing noise and obscuring more important
compiler warnings.  This change removes them.
2015-11-10 10:13:52 -05:00
David Hoover 1709ed3a2e Add @Deprecated annotations to things documented as @deprecated. 2015-04-19 14:50:12 -07:00
Jesse Glick 22d433deae So far unsuccessful attempt to make Jenkins startup more robust against bugs like JENKINS-25440.
Even though SezpozModule.configure catches and ignores the faulty component, Guice still dies:
… hudson.ExtensionFinder$GuiceFinder <init>
SEVERE: Failed to create Guice container from all the plugins
com.google.inject.internal.guava.collect.$ComputationException: java.lang.NoClassDefFoundError: org/eclipse/jgit/storage/file/FileRepository
	at …
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:279)
2014-11-04 17:45:52 -05:00
Jesse Glick 253943e13e [JENKINS-5756] Removing workarounds for HotSpot bug.
https://bugs.openjdk.java.net/browse/JDK-6933067 claims to be fixed as of Java 6, our baseline.
2014-09-24 09:32:50 -04:00
Jesse Glick 53d1e20f62 If an optional component cannot be loaded, print a polite one-line message, not a big scary stack trace.
(To reproduce: BuildNowTextPropertyTest from cloudbees-template warns about FolderProxyGroupContainer.)
2013-05-02 14:55:06 -04:00
Jesse Glick 4ab9c096bc Be more resilient against Guice errors.
com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance can throw NCDFE, it seems.
2012-09-20 17:58:33 -04:00
Kohsuke Kawaguchi 9a178aa8cc Added a mechanism to filter extension points as they are discovered.
I couldn't quite find one place to do this, so it's spread apart
somewhat.
2012-06-15 13:42:23 -07:00
Vojtech Juranek 6788f82a2c [FIXED JENKINS-13448] Added additional checks if Guice will be able to create injector to exclude missing extension poins. 2012-04-13 22:56:21 +02:00
Kohsuke Kawaguchi f19678d083 exposing major singletons to IoC 2012-02-29 15:23:20 -08:00
Kohsuke Kawaguchi a71d037b84 Revisited the way Guice creates an injector during unit test
The motivation of this is to enable test code to inject components from Jenkins, which means we need a single Injector that can see all of those, including @TestExtension and regular @Extension. Then I realized that the current implementation is broken, as it creates two independent Injectors. This has other undesirable side effects like @TestExtension components not being able to inject @Extensions, etc.

I briefly experimented with hierarchical Injectors (where we first create Injector that loads @Extension then create another that loads @TestExtension as a child), but this was hard to get right as we have no control over which ExtensionFinder gets instantiated first --- we'd be at the mercy of SezPoz.

So the eventual approach is to allow a single GuiceFinder to recognize multiple annotations. This also works well with our using child injector for installing plugins without restart
2012-02-09 12:18:05 -08:00
Kohsuke Kawaguchi 992158b67e filled in the real version 2011-11-28 17:01:22 -08:00
Kohsuke Kawaguchi a9be16e25e Cosmetic change 2011-11-15 21:18:55 -08:00
Kohsuke Kawaguchi 82ef72c00d Expose Injector to the rest of the world 2011-11-15 17:31:49 -08:00
Kohsuke Kawaguchi 09ef861c98 Step 1: make ExtensionFinder support refreshing 2011-11-15 17:31:49 -08:00
Kohsuke Kawaguchi 71cbf93a36 doc improvement 2011-10-27 06:35:21 -07:00
Kohsuke Kawaguchi ab421b59d2 [JENKINS-11279] Guice appears to throw RuntimeException sometimes. 2011-10-11 06:56:44 +09:00
Kohsuke Kawaguchi 87f89bc3ab [FIXED JENKINS-11279] more eager scouting 2011-10-11 06:56:44 +09:00
Kohsuke Kawaguchi 5d903514bd improve error recovery behaviour 2011-09-23 15:16:33 -07:00
Kohsuke Kawaguchi c1451269c3 follow up merge fixes 2011-09-21 22:00:38 -07:00
Kohsuke Kawaguchi e17760256e merged with the latest trunk 2011-09-21 21:41:57 -07:00
Kohsuke Kawaguchi 5dddebcf94 Corrected backward incompatible signature changes in 70c1065814. 2011-06-17 22:01:45 -07:00
Nigel Magnay 5679d019ec Move hudson.model.Jenkins to be jenkins.model.Jenkins - part II
Just import changes, from hudson.model.Jenkins -> jenkins.model.Jenkins,
and Javadoc comments.

Signed-off-by: Nigel Magnay <nigel.magnay@gmail.com>
2011-05-29 11:06:28 +01:00
Nigel Magnay 70c1065814 Stage 1 : Create hudson.model.Jenkins, make Hudson derive from Jenkins.
Signed-off-by: Nigel Magnay <nigel.magnay@gmail.com>
2011-05-29 11:00:58 +01:00
Kohsuke Kawaguchi 3614868694 Merge branch 'oss'
Conflicts:
	core/src/main/java/hudson/Functions.java
	core/src/main/java/hudson/model/AutoCompletionCandidates.java
	core/src/main/java/hudson/model/ViewDescriptor.java
	core/src/main/resources/lib/hudson/3rdPartyLicenses.jelly
	core/src/main/resources/lib/hudson/newFromList/form.jelly
	core/src/main/resources/lib/hudson/projectViewRow.jelly
	core/src/main/resources/lib/hudson/thirdPartyLicenses.jelly
	core/src/main/resources/lib/layout/renderOnDemand.jelly
	core/src/test/java/hudson/FilePathTest.java
	test/src/test/resources/lib/layout/RenderOnDemandTest/testBehaviour.jelly
	test/src/test/resources/scripts/BehaviorTest/testCssSelectors.jelly
	ui-samples-plugin/src/main/resources/hudson/plugins/ui_samples/JavaScriptProxy/index.jelly
2011-04-21 15:37:31 -07:00
Kohsuke Kawaguchi ec616605d8 reduced excessive logging on failure to load optional components 2011-04-21 13:53:31 -07:00
Kohsuke Kawaguchi c8d7af2d7d Fixed an AbstractMethodError in ItemGroupMixin.create when using some
older plugins.
2011-03-22 19:09:53 -07:00
Kohsuke Kawaguchi ba092e9a29 typo 2011-01-14 08:15:59 -08:00
Kohsuke Kawaguchi ed20962551 Improved the startup performance.
An investigation on NECTAR-50 revealed that the dead lock prevention made in 02fbfd9ed5 and c5269550d5 are causing slow down by having too many threads go through scouting, which in turn calls into classloader (which is synchronized.) Reduce the overhead by reusing sezpoz index so that classloading overhead is minimal.
2011-01-13 16:02:41 -08:00
Kohsuke Kawaguchi 5e3f165815 typo 2011-01-13 16:01:33 -08:00
Kohsuke Kawaguchi 95d12a81de updated to work with Guice 3.0 RC1 2010-12-11 00:48:23 -08:00
Kohsuke Kawaguchi 5c2c146d91 introducing the base abstrat class to reuse the logic in @TestExtension 2010-12-10 10:56:34 -08:00
Kohsuke Kawaguchi 60d7c2bf28 folded them back into ExtensionFinder as it was too small to be its own package 2010-12-10 10:40:02 -08:00
Kohsuke Kawaguchi 53597a5d2d introducing Guice-based injector 2010-12-10 10:23:39 -08:00
Kohsuke Kawaguchi 001507695e experimenting 2010-11-26 16:37:49 -08:00
kohsuke 11bcb9f59f Fixed a bug where non-existent optional dependencies can result in a cascading load failure.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@36213 71c3de6d-444a-0410-be80-ed276b4c234a
2010-10-25 18:59:35 +00:00
kohsuke 24c97b9f83 [FIXED HUDSON-7380] Handle initialization problem more gracefully
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34544 71c3de6d-444a-0410-be80-ed276b4c234a
2010-09-08 05:39:14 +00:00