Skip to content

Commit

Permalink
code samples: apply "Plugin DevKit | Code | Extension class should be…
Browse files Browse the repository at this point in the history
… final and non-public"
  • Loading branch information
YannCebron committed Oct 25, 2023
1 parent 742a193 commit 0cb1bff
Show file tree
Hide file tree
Showing 37 changed files with 67 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Implements an inspection to detect when String references are compared using 'a==b' or 'a!=b'.
* The quick fix converts these comparisons to 'a.equals(b) or '!a.equals(b)' respectively.
*/
public class ComparingStringReferencesInspection extends AbstractBaseJavaLocalInspectionTool {
final class ComparingStringReferencesInspection extends AbstractBaseJavaLocalInspectionTool {

private final ReplaceWithEqualsQuickFix myQuickFix = new ReplaceWithEqualsQuickFix();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Implements an intention action to replace a ternary statement with if-then-else.
*/
@NonNls
public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction implements IntentionAction {
final class ConditionalOperatorConverter extends PsiElementBaseIntentionAction implements IntentionAction {

/**
* Checks whether this intention is available at the caret offset in file - the caret must sit just before a "?"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.editor;

Expand All @@ -15,7 +15,7 @@
* The execute method inserts a fixed string at Offset 0 of the document.
* Document changes are made in the context of a write action.
*/
class MyTypedHandler extends TypedHandlerDelegate {
final class MyTypedHandler extends TypedHandlerDelegate {

@NotNull
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.facet;

Expand All @@ -18,7 +18,7 @@
* Provides creation of {@link DemoFacet} and associated Configuration.
* Allows application of this facet to all {@link ModuleType} instances.
*/
public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
final class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {

public static final String FACET_ID = "DEMO_FACET_ID";
public static final String FACET_NAME = "SDK Facet";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.framework;

Expand All @@ -15,11 +15,11 @@

import javax.swing.*;

public class DemoFramework extends FrameworkTypeEx {
final class DemoFramework extends FrameworkTypeEx {

public static final String FRAMEWORK_ID = "org.intellij.sdk.framework.DemoFramework";

protected DemoFramework() {
DemoFramework() {
super(FRAMEWORK_ID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.intellij.codeInsight.template.TemplateContextType;
import org.jetbrains.annotations.NotNull;

public class MarkdownContext extends TemplateContextType {
final class MarkdownContext extends TemplateContextType {

protected MarkdownContext() {
MarkdownContext() {
super("Markdown");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.liveTemplates;

Expand All @@ -7,7 +7,7 @@
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;

public class TitleCaseMacro extends MacroBase {
final class TitleCaseMacro extends MacroBase {

public TitleCaseMacro() {
super("titleCase", "titleCase(String)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Invoked on opening a project.
*/
public class ProjectOpenStartupActivity implements StartupActivity.DumbAware {
final class ProjectOpenStartupActivity implements StartupActivity.DumbAware {

@Override
public void runActivity(@NotNull Project project) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.module;

Expand All @@ -12,11 +12,11 @@

import javax.swing.*;

public class DemoModuleType extends ModuleType<DemoModuleBuilder> {
final class DemoModuleType extends ModuleType<DemoModuleBuilder> {

private static final String ID = "DEMO_MODULE_TYPE";

public DemoModuleType() {
DemoModuleType() {
super(ID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

import javax.swing.tree.DefaultTreeModel;

public class ImagesProjectViewPane extends ProjectViewPane {
final class ImagesProjectViewPane extends ProjectViewPane {

public static final String ID = "IMAGES";

protected ImagesProjectViewPane(Project project) {
ImagesProjectViewPane(Project project) {
super(project);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.project.wizard;

Expand All @@ -12,7 +12,7 @@

import javax.swing.*;

public class DemoModuleWizardStep extends ModuleBuilder {
final class DemoModuleWizardStep extends ModuleBuilder {

public void setupRootModel(@NotNull ModifiableRootModel modifiableRootModel) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.NotNullLazyValue;

public class DemoRunConfigurationType extends ConfigurationTypeBase {
final class DemoRunConfigurationType extends ConfigurationTypeBase {

static final String ID = "DemoRunConfiguration";

protected DemoRunConfigurationType() {
DemoRunConfigurationType() {
super(ID, "Demo", "Demo run configuration type",
NotNullLazyValue.createValue(() -> AllIcons.Nodes.Console));
addFactory(new DemoConfigurationFactory(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Provides controller functionality for application settings.
*/
public class AppSettingsConfigurable implements Configurable {
final class AppSettingsConfigurable implements Configurable {

private AppSettingsComponent mySettingsComponent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
name = "org.intellij.sdk.settings.AppSettingsState",
storages = @Storage("SdkSettingsPlugin.xml")
)
public class AppSettingsState implements PersistentStateComponent<AppSettingsState> {
final class AppSettingsState implements PersistentStateComponent<AppSettingsState> {

public String userId = "John Q. Public";
public boolean ideaStatus = false;

public static AppSettingsState getInstance() {
static AppSettingsState getInstance() {
return ApplicationManager.getApplication().getService(AppSettingsState.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.List;

public class SimpleAnnotator implements Annotator {
final class SimpleAnnotator implements Annotator {

// Define strings for the Simple language prefix - used for annotations, line markers, etc.
public static final String SIMPLE_PREFIX_STR = "simple";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.List;
import java.util.Objects;

public class SimpleChooseByNameContributor implements ChooseByNameContributorEx {
final class SimpleChooseByNameContributor implements ChooseByNameContributorEx {

@Override
public void processNames(@NotNull Processor<? super String> processor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
final class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {

@Override
public CustomCodeStyleSettings createCustomSettings(@NotNull CodeStyleSettings settings) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -13,7 +13,7 @@
import javax.swing.*;
import java.util.Map;

public class SimpleColorSettingsPage implements ColorSettingsPage {
final class SimpleColorSettingsPage implements ColorSettingsPage {

private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{
new AttributesDescriptor("Key", SimpleSyntaxHighlighter.KEY),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

import com.intellij.lang.Commenter;
import org.jetbrains.annotations.Nullable;

public class SimpleCommenter implements Commenter {
final class SimpleCommenter implements Commenter {

@Nullable
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -9,9 +9,9 @@
import org.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;

public class SimpleCompletionContributor extends CompletionContributor {
final class SimpleCompletionContributor extends CompletionContributor {

public SimpleCompletionContributor() {
SimpleCompletionContributor() {
extend(CompletionType.BASIC, PlatformPatterns.psiElement(SimpleTypes.VALUE),
new CompletionProvider<>() {
public void addCompletions(@NotNull CompletionParameters parameters,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.intellij.sdk.language;

import com.intellij.lang.documentation.AbstractDocumentationProvider;
Expand All @@ -16,7 +17,7 @@
*
* @see <a href="https://plugins.jetbrains.com/docs/intellij/documentation.html">Documentation (IntelliJ Platform Docs)</a>
*/
public class SimpleDocumentationProvider extends AbstractDocumentationProvider {
final class SimpleDocumentationProvider extends AbstractDocumentationProvider {

/**
* For the Simple Language, we don't have online documentation. However, if your language provides
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -8,7 +8,7 @@

import javax.swing.*;

public class SimpleFileType extends LanguageFileType {
public final class SimpleFileType extends LanguageFileType {

public static final SimpleFileType INSTANCE = new SimpleFileType();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -13,7 +13,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class SimpleFindUsagesProvider implements FindUsagesProvider {
final class SimpleFindUsagesProvider implements FindUsagesProvider {

@Nullable
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Collections;
import java.util.List;

public class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
final class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {

@Override
public FoldingDescriptor @NotNull [] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -7,7 +7,7 @@
import org.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;

public class SimpleFormattingModelBuilder implements FormattingModelBuilder {
final class SimpleFormattingModelBuilder implements FormattingModelBuilder {

private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -7,7 +7,7 @@
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
import org.jetbrains.annotations.NotNull;

public class SimpleLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettingsProvider {
final class SimpleLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettingsProvider {

@NotNull
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -15,7 +15,7 @@
import java.util.Collection;
import java.util.List;

public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
final class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {

@Override
protected void collectNavigationMarkers(@NotNull PsiElement element,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.intellij.sdk.language;

Expand All @@ -18,7 +18,7 @@
import org.intellij.sdk.language.psi.SimpleTypes;
import org.jetbrains.annotations.NotNull;

public class SimpleParserDefinition implements ParserDefinition {
final class SimpleParserDefinition implements ParserDefinition {

public static final IFileElementType FILE = new IFileElementType(SimpleLanguage.INSTANCE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import javax.swing.*;

public class SimplePropertyIconProvider extends IconProvider {
final class SimplePropertyIconProvider extends IconProvider {

@Override
public @Nullable Icon getIcon(@NotNull PsiElement element, int flags) {
Expand Down
Loading

0 comments on commit 0cb1bff

Please sign in to comment.