Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating upstream #2

Merged
merged 32 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7782312
Merge pull request #59 from fbaro/master
phax Dec 13, 2017
0c16e7e
Further adoption for #58
phax Dec 13, 2017
2626edd
Updated news
phax Dec 13, 2017
ab59446
Version update
phax Dec 20, 2017
96918ce
Verison update
phax Jan 2, 2018
c3df6de
Updated to 2018
phax Jan 5, 2018
94ad069
Version update
phax Jan 8, 2018
415548a
Version update
phax Jan 24, 2018
d8fcc0f
Version update
phax Jan 29, 2018
3a4f93d
Updated parent POM
phax Jan 29, 2018
5953ee5
Version update
phax Feb 19, 2018
ef9ff1d
Version update
phax Mar 4, 2018
8b4ec4f
Verison update
phax Mar 5, 2018
b76c2cb
Updated parent POM version
phax Mar 7, 2018
01d5039
Version update
phax Mar 13, 2018
6d2d80b
Version update
phax Mar 22, 2018
a37348e
Version update
phax Mar 23, 2018
110c890
Version update
phax Apr 5, 2018
70641cc
Version update
phax Apr 11, 2018
c566e37
Added some additional `JInvocation.arg...` sanity methods
phax Apr 11, 2018
464dec6
Made enum constant arguments accessible
phax Apr 11, 2018
cb5b17c
Prepared for release
phax Apr 11, 2018
b431d59
[maven-release-plugin] prepare release jcodemodel-3.0.2
phax Apr 11, 2018
e48e9ac
[maven-release-plugin] prepare for next development iteration
phax Apr 11, 2018
cf0c847
Version update
phax Apr 17, 2018
eceb287
Improved java docs
phax Apr 20, 2018
9dcb8e9
Added getInner as requested by #60
phax Apr 23, 2018
9efbdba
Merge branch 'master' of https://github.com/phax/jcodemodel.git
phax Apr 23, 2018
fb14fe0
Improved inner classes API
phax Apr 23, 2018
58ba3fb
Improved javadocs
phax Apr 23, 2018
a6d5454
Version update
phax May 4, 2018
ddd9183
Version update
phax May 9, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ this would be very tricky.

A site with the links to the [API docs](http://phax.github.io/jcodemodel/) etc. is available.

## News and noteworthy
# News and noteworthy

* v3.0.3 - work in progress
* Improved API access to inner classes (issue #60)
* v3.0.2 - 2018-04-11
* Fixed method resolution using direct class references (issue #58)
* Added some additional `JInvocation.arg...` sanity methods
* Enum constant argument list is now accessible
* v3.0.1 - 2017-10-25
* Added explicit support for invoking `super` - thx to @heruan for pointing this out
* Added possibility to create a lambda reference from an invocation (issue #56 and PR #57 from @heruan)
Expand Down Expand Up @@ -82,11 +88,11 @@ Add the following to your pom.xml to use this artifact:
<dependency>
<groupId>com.helger</groupId>
<artifactId>jcodemodel</artifactId>
<version>3.0.1</version>
<version>3.0.2</version>
</dependency>
```

---

My personal [Coding Styleguide](https://github.com/phax/meta/blob/master/CodeingStyleguide.md) |
My personal [Coding Styleguide](https://github.com/phax/meta/blob/master/CodingStyleguide.md) |
On Twitter: <a href="https://twitter.com/philiphelger">@philiphelger</a>
2 changes: 1 addition & 1 deletion findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
Portions Copyright 2013-2017 Philip Helger + contributors
Portions Copyright 2013-2018 Philip Helger + contributors

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
Portions Copyright 2013-2017 Philip Helger + contributors
Portions Copyright 2013-2018 Philip Helger + contributors

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -46,10 +46,10 @@
<parent>
<groupId>com.helger</groupId>
<artifactId>parent-pom</artifactId>
<version>1.9.3</version>
<version>1.10.3</version>
</parent>
<artifactId>jcodemodel</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.3-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>jcodemodel</name>
<description>Java code generation library</description>
Expand Down Expand Up @@ -137,7 +137,7 @@
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.5.6</version>
<version>3.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/etc/javadoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/etc/license-template.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
Portions Copyright 2013-2017 Philip Helger + contributors
Portions Copyright 2013-2018 Philip Helger + contributors

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
39 changes: 38 additions & 1 deletion src/main/java/com/helger/jcodemodel/AbstractJClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -42,6 +42,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -425,6 +426,42 @@ public final JTypeWildcard wildcard (@Nonnull final EWildcardBoundMode eMode)
protected abstract AbstractJClass substituteParams (@Nonnull JTypeVar [] aVariables,
@Nonnull List <? extends AbstractJClass> aBindings);

/**
* Get all inner classes of this class.
*
* @return Never <code>null</code>.
* @since 3.0.3
*/
@Nonnull
public Collection <AbstractJClassContainer <?>> getAllInnerClasses ()
{
if (this instanceof AbstractJClassContainer <?>)
{
@SuppressWarnings ("rawtypes")
final Collection <AbstractJClassContainer <?>> aInnerClasses = ((AbstractJClassContainer) this).classes ();
return aInnerClasses;
}
return Collections.emptyList ();
}

/**
* Check if this class is a class container and if so try to find the inner
* class with the provided name.
*
* @param sName
* The name to check. May be <code>null</code>.
* @return The inner class with the provided name.
* @since 3.0.3
*/
@Nullable
public AbstractJClassContainer <?> getInnerClass (@Nullable final String sName)
{
for (final AbstractJClassContainer <?> aInnerClass : getAllInnerClasses ())
if (aInnerClass.name ().equals (sName))
return aInnerClass;
return null;
}

/**
* @return name<code>.class</code>
*/
Expand Down
31 changes: 15 additions & 16 deletions src/main/java/com/helger/jcodemodel/AbstractJClassContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -82,8 +82,6 @@ public abstract class AbstractJClassContainer <CLASSTYPE extends AbstractJClassC
* capitalized in a case sensitive file system (
* {@link JCodeModel#isFileSystemCaseSensitive()}) to avoid conflicts. Lazily
* created to save footprint.
*
* @see #_getClasses()
*/
protected Map <String, CLASSTYPE> m_aClasses;

Expand Down Expand Up @@ -178,7 +176,8 @@ public String fullName ()
}

/**
* @return <code>true</code> if this is an anonymous class.
* @return <code>true</code> if this is an anonymous class. Note: this applies
* only to classes.
*/
public final boolean isAnonymous ()
{
Expand Down Expand Up @@ -213,14 +212,6 @@ public final JPackage getPackage ()
return parentContainer ().getPackage ();
}

@Nonnull
private Map <String, CLASSTYPE> _getClasses ()
{
if (m_aClasses == null)
m_aClasses = new TreeMap <> ();
return m_aClasses;
}

@Nonnull
protected abstract CLASSTYPE createInnerClass (final int nMods,
@Nonnull final EClassType eClassType,
Expand All @@ -237,17 +228,25 @@ public final CLASSTYPE _class (final int nMods,
else
sRealName = sName;

final CLASSTYPE aExistingClass = _getClasses ().get (sRealName);
if (aExistingClass != null)
throw new JClassAlreadyExistsException (aExistingClass);
// Existing class?
if (m_aClasses != null)
{
final CLASSTYPE aExistingClass = m_aClasses.get (sRealName);
if (aExistingClass != null)
throw new JClassAlreadyExistsException (aExistingClass);
}
else
m_aClasses = new TreeMap <> ();

// Create and add inner class
final CLASSTYPE c = createInnerClass (nMods, eClassType, sName);
_getClasses ().put (sRealName, c);
m_aClasses.put (sRealName, c);
return c;
}

/**
* Returns an iterator that walks the nested classes defined in this class.
* Don't modify the returned collection!
*/
@Nonnull
public final Collection <CLASSTYPE> classes ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/AbstractJType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/EClassType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJAnnotatable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJClassContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJDocCommentable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJExpression.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJGenerable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJGenerifiable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/helger/jcodemodel/IJObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
* Portions Copyright 2013-2017 Philip Helger + contributors
* Portions Copyright 2013-2018 Philip Helger + contributors
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down
Loading