Expand my Community achievements bar.

SOLVED

CQRules:CQBP-84 - archetype 27

Avatar

Level 3

Hi community,

 

i'm receiving this error:

"

The product interface com.day.cq.dam.api.Rendition annotated with @ProviderType should not be implemented by custom code. Detected in com.adobe.cq.wcm.core.components.internal.servlets.EnhancedRendition contained in /apps/<MYPROJECT>-vendor-packages/application/install/core.wcm.components.core-2.15.2.jar.

"

during the cloud manager deploy as Critical Bug CQRules:CQBP-84.

The project it was created with archetype 27.

 

I found this article: https://github.com/adobe/aem-project-archetype/issues/736

 

Any suggest about?

 

As per now i'm receiving D rating for that.

davidef34326447_0-1634722237597.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Upgrade the core jar to 2.17-

 

I could see below code in 2.15 jar-

 

public class EnhancedRendition extends ResourceWrapper implements Rendition {

private static final Logger LOG = LoggerFactory.getLogger(EnhancedRendition.class);

private Rendition rendition;
private Dimension dimension;
private boolean dimensionProcessed = false;

public EnhancedRendition(@NotNull Rendition rendition) {
super(rendition);
this.rendition = rendition;
}

/**
* Getter for the rendition's dimension.
*
* @Return rendition

 

which is causing issue(EnhancedRendition extends ResourceWrapper implements Rendition).

 

Product APIs annotated with @ProviderType should not be implemented or extended by customers

Key: CQBP-84

Type: Bug

Severity: Critical

Since: Version 2018.7.0

The AEM API contains Java interfaces and classes which are only meant to be used, but not implemented, by custom code. For example, the interface com.day.cq.wcm.api.Page is designed to be implemented by AEM only.

When new methods are added to these interfaces, those additional methods do not impact existing code which uses these interfaces and, as a result, the addition of new methods to these interfaces are considered to be backwards-compatible. However, if custom code implements one of these interfaces, that custom code has introduced a backwards-compatibility risk for the customer.

Interfaces (and classes) which are only intended to be implemented by AEM are annotated with org.osgi.annotation.versioning.ProviderType (or, in some cases, a similar legacy annotation aQute.bnd.annotation.ProviderType). This rule identifies the cases where such an interface is implemented (or a class is extended) by custom code.

Non-Compliant Code

import com.day.cq.wcm.api.Page;

public class DontDoThis implements Page {
// implementation here
}

 

In 2.17 jar -

 

 

/**

* A {@link Rendition} delegate that facilitates finding out the rendition's dimensions.

*/

public class EnhancedRendition {

 

    private static final Logger LOG = LoggerFactory.getLogger(EnhancedRendition.class);

 

    private Rendition rendition;

    private Dimension dimension;

    private boolean dimensionProcessed = false;

 

    public EnhancedRendition(@notnull Rendition rendition) {

        this.rendition = rendition;

    }

 

    /**

     * Getter for the rendition's dimension.

     *

     * @Return rendition's dimension if possible to determine, {@code null} otherwise

     */

 

So this particular issue would be resolved if you use the latest core component jar file.

 

Hope that solves the pipeline code quality issue.

 

Regards

Ankur

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Upgrade the core jar to 2.17-

 

I could see below code in 2.15 jar-

 

public class EnhancedRendition extends ResourceWrapper implements Rendition {

private static final Logger LOG = LoggerFactory.getLogger(EnhancedRendition.class);

private Rendition rendition;
private Dimension dimension;
private boolean dimensionProcessed = false;

public EnhancedRendition(@NotNull Rendition rendition) {
super(rendition);
this.rendition = rendition;
}

/**
* Getter for the rendition's dimension.
*
* @Return rendition

 

which is causing issue(EnhancedRendition extends ResourceWrapper implements Rendition).

 

Product APIs annotated with @ProviderType should not be implemented or extended by customers

Key: CQBP-84

Type: Bug

Severity: Critical

Since: Version 2018.7.0

The AEM API contains Java interfaces and classes which are only meant to be used, but not implemented, by custom code. For example, the interface com.day.cq.wcm.api.Page is designed to be implemented by AEM only.

When new methods are added to these interfaces, those additional methods do not impact existing code which uses these interfaces and, as a result, the addition of new methods to these interfaces are considered to be backwards-compatible. However, if custom code implements one of these interfaces, that custom code has introduced a backwards-compatibility risk for the customer.

Interfaces (and classes) which are only intended to be implemented by AEM are annotated with org.osgi.annotation.versioning.ProviderType (or, in some cases, a similar legacy annotation aQute.bnd.annotation.ProviderType). This rule identifies the cases where such an interface is implemented (or a class is extended) by custom code.

Non-Compliant Code

import com.day.cq.wcm.api.Page;

public class DontDoThis implements Page {
// implementation here
}

 

In 2.17 jar -

 

 

/**

* A {@link Rendition} delegate that facilitates finding out the rendition's dimensions.

*/

public class EnhancedRendition {

 

    private static final Logger LOG = LoggerFactory.getLogger(EnhancedRendition.class);

 

    private Rendition rendition;

    private Dimension dimension;

    private boolean dimensionProcessed = false;

 

    public EnhancedRendition(@notnull Rendition rendition) {

        this.rendition = rendition;

    }

 

    /**

     * Getter for the rendition's dimension.

     *

     * @Return rendition's dimension if possible to determine, {@code null} otherwise

     */

 

So this particular issue would be resolved if you use the latest core component jar file.

 

Hope that solves the pipeline code quality issue.

 

Regards

Ankur

Avatar

Level 2

Hi @Ankur_Khare thank you...able to see this working with core.wcm.components.core-2.17.12.jar