[MGNLSTK-1546] All I18nable definitions should have default constructors. Created: 12/Dec/16 Updated: 15/Dec/16 Resolved: 12/Dec/16 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | templates |
| Affects Version/s: | None |
| Fix Version/s: | 2.9.6, 3.0.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Michael Mühlebach | Assignee: | Roman Kovařík |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 1h | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Date of First Response: | |||||||||
| Sprint: | Kromeriz 74 | ||||||||
| Story Points: | 2 | ||||||||
| Description |
[INFO] [talledLocalContainer] 2016-12-12 06:19:00,172 ERROR info.magnolia.pages.app.editor.PagesEditorSubApp : An error occurred while executing action [addComponent]
[INFO] [talledLocalContainer] info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: addComponent
[INFO] [talledLocalContainer] at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:64)
[INFO] [talledLocalContainer] at info.magnolia.pages.app.editor.PagesEditorSubApp.prepareAndExecutePagesEditorAction(PagesEditorSubApp.java:336)
[INFO] [talledLocalContainer] at info.magnolia.pages.app.editor.PagesEditorSubApp.onActionbarItemClicked(PagesEditorSubApp.java:320)
[8:56 AM] Philip Mundt:
[INFO] [talledLocalContainer] Caused by: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
[INFO] [talledLocalContainer] at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:874)
|
| Comments |
| Comment by Roman Kovařík [ 12/Dec/16 ] |
|
To scan the definitions:
<dependency>
<groupId>io.github.lukehutch</groupId>
<artifactId>fast-classpath-scanner</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
<version>0.8.4</version>
</dependency>
/** * This file Copyright (c) 2012-2016 Magnolia International * Ltd. (http://www.magnolia-cms.com). All rights reserved. * * * This file is dual-licensed under both the Magnolia * Network Agreement and the GNU General Public License. * You may elect to use one or the other of these licenses. * * This file is distributed in the hope that it will be * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT. * Redistribution, except as permitted by whichever of the GPL * or MNA you select, is prohibited. * * 1. For the GPL license (GPL), you can redistribute and/or * modify this file under the terms of the GNU General * Public License, Version 3, as published by the Free Software * Foundation. You should have received a copy of the GNU * General Public License, Version 3 along with this program; * if not, write to the Free Software Foundation, Inc., 51 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * 2. For the Magnolia Network Agreement (MNA), this file * and the accompanying materials are made available under the * terms of the MNA which accompanies this distribution, and * is available at http://www.magnolia-cms.com/mna.html * * Any modifications to this file must keep this entire header * intact. */ package info.magnolia.module.templatingkit.templates.components; import info.magnolia.i18nsystem.I18nable; import java.util.List; import org.junit.Test; import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.PojoMethod; import com.openpojo.reflection.impl.PojoClassFactory; import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner; public class ScanI18nableDefinitions { @Test public void findDefinitionsWithoutDefaultCtor() throws ClassNotFoundException { final String packageName = "info.magnolia"; final List<String> classNames = new FastClasspathScanner(packageName) .scan() .getNamesOfClassesWithAnnotation(I18nable.class); for(String clazz: classNames) { for (PojoClass pojoClass : PojoClassFactory.enumerateClassesByExtendingType(packageName, Class.forName(clazz), null)) { boolean has = false; for (PojoMethod ctor : pojoClass.getPojoConstructors()) { if (ctor.getGenericParameterTypes().length == 0) { has = true; break; } } if (!has) { System.out.println("Missing default ctor for: " + pojoClass.getClazz()); } } } } } |