diff --git a/README.md b/README.md index 57e333f7..d1e2dbab 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ [![PyPi version](https://img.shields.io/pypi/v/aibolit.svg)](https://pypi.org/project/aibolit/) -[![Build Status](https://travis-ci.org/yegor256/aibolit.svg)](https://travis-ci.org/yegor256/aibolit) -[![Build status](https://ci.appveyor.com/api/projects/status/1k7q7eumnhia0e3a?svg=true)](https://ci.appveyor.com/project/yegor256/aibolit) -[![Hits-of-Code](https://hitsofcode.com/github/yegor256/aibolit)](https://hitsofcode.com/view/github/yegor256/aibolit) -[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/aibolit.svg)](https://codecov.io/github/yegor256/aibolit?branch=master) -[![Maintainability](https://api.codeclimate.com/v1/badges/e90e80a143a9457ee3af/maintainability)](https://codeclimate.com/github/yegor256/aibolit/maintainability) -[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/aibolit/blob/master/LICENSE.txt) +[![Build Status](https://travis-ci.org/cqfn/aibolit.svg)](https://travis-ci.org/cqfn/aibolit) +[![Build status](https://ci.appveyor.com/api/projects/status/gr3eqxq5pr87kpwg?svg=true)](https://ci.appveyor.com/project/yegor256/aibolit) +[![Hits-of-Code](https://hitsofcode.com/github/cqfn/aibolit)](https://hitsofcode.com/view/github/cqfn/aibolit) +[![Test Coverage](https://img.shields.io/codecov/c/github/cqfn/aibolit.svg)](https://codecov.io/github/cqfn/aibolit?branch=master) +[![Maintainability](https://api.codeclimate.com/v1/badges/fd7e32d8472b4d5e8ecb/maintainability)](https://codeclimate.com/github/cqfn/aibolit/maintainability) +[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cqfn/aibolit/blob/master/LICENSE.txt) First, you install it (you must have [Python 3.7.7](https://www.python.org/downloads/) and [Pip](https://pip.pypa.io/en/stable/installing/) installed): @@ -15,8 +15,6 @@ and [Pip](https://pip.pypa.io/en/stable/installing/) installed): $ pip3 install aibolit ``` -### Recommend command - To analyze your Java sources, located at `src/java` (for example), run: ```bash @@ -34,11 +32,11 @@ Also, you can set a folder with Java files: $ aibolit recommend --folder src/java ``` -It will run recommendation function for the model (model is located in [aibolit/binary_files/model.pkl](https://github.com/yegor256/aibolit/blob/master/aibolit/binary_files/model.pkl). -The model finds a pattern which contribution is the largest to the Cyclomatic Complexity. -If anything is found, you will see all recommendations for the mentioned patterns. -You can see the list of all patterns in [Patterns.md](https://github.com/yegor256/aibolit/blob/master/PATTERNS.md). -The output of recommendation will be redirected to the stdout. +It will run recommendation function for the model (model is located in [aibolit/binary_files/model.pkl](https://github.com/cqfn/aibolit/blob/master/aibolit/binary_files/model.pkl). +The model finds a pattern which contribution is the largest to the Cyclomatic Complexity. +If anything is found, you will see all recommendations for the mentioned patterns. +You can see the list of all patterns in [Patterns.md](https://github.com/cqfn/aibolit/blob/master/PATTERNS.md). +The output of recommendation will be redirected to the stdout. If the program has the `0` exit code, it means that all analyzed files do not have any issues. If the program has the `1` exit code, it means that at least 1 analyzed file has an issue. If the program has the `2` exit code, it means that program crash occurred. @@ -73,7 +71,7 @@ Show all patterns /mnt/d/src/java/Configuration.java[3261]: Partial synchronized (P14: 0.228 4/4) /mnt/d/src/java/Configuration.java[3727]: Partial synchronized (P14: 0.228 4/4) /mnt/d/src/java/Configuration.java[3956]: Partial synchronized (P14: 0.228 4/4) -/mnt/d/src/java/ErrorExample.java: error when calculating patterns: Can't count P1 metric: +/mnt/d/src/java/ErrorExample.java: error when calculating patterns: Can't count P1 metric: Total score: 127.67642529949538 ``` @@ -106,7 +104,7 @@ Show all patterns /mnt/d/src/java/Configuration.java[3844]: Var in the middle (P21: 30.95612931128819 1/4) /mnt/d/src/java/Configuration.java[3848]: Var in the middle (P21: 30.95612931128819 1/4) /mnt/d/src/java/Configuration.java[3956]: Partial synchronized (P14: 0.228 4/4) -/mnt/d/src/java/ErrorExample.java: error when calculating patterns: Can't count P1 metric: +/mnt/d/src/java/ErrorExample.java: error when calculating patterns: Can't count P1 metric: /mnt/d/src/java/MavenSlice.java: your code is perfect in aibolit's opinion Total score: 127.67642529949538 ``` @@ -172,8 +170,8 @@ You can also choose xml format. It will have the same format as `text` mode, but ``` -The score is the relative importance of the pattern (there is no range for it). -The larger score is, the most important pattern is. +The score is the relative importance of the pattern (there is no range for it). +The larger score is, the most important pattern is. E.g., if you have several patterns, first you need to fix the pattern with the score 5.45: ``` @@ -219,27 +217,28 @@ You can get full report with `--full` command, then all patterns will be include $ aibolit recommend --folder src/java --full ``` -You can exclude folder with `--exclude` command. The last parameter is the folder to exclude, +You can exclude folder with `--exclude` command. The last parameter is the folder to exclude, the rest of them are glob patterns. ```bash $ aibolit recommend --folder src/java --exclude=**/*Test*.java --exclude=**/*Impl*.java --exclude=/mnt/d/src/java/tests ``` -If you need help, run +If you need help, run ```bash $ aibolit recommend --help ``` -### Train command +## How to retrain it? + `Train` command does the following: - Calculates patterns and metrics - Creates a dataset - - Trains model and save it - + - Trains model and save it + Train works only with cloned git repository. - 1. Clone aibolit repository + 1. Clone aibolit repository 2. Go to `cloned_aibolit_path` 3. Run `pip install .` 4. Set env variable `export HOME_AIBOLIT=cloned_aibolit_path` (example for Linux). @@ -247,9 +246,9 @@ $ aibolit recommend --help Otherwise model will be saved into `cloned_aibolit_path/aibolit/binary_files/model.pkl` 6. If you need to set up own folder with Java files, use `--java_folder parameter`, the default value will be `scripts/target/01` of aibolit cloned repo 7. You need to install Java 13 and Maven - + Or you can use our docker image (link will be soon here) - + Run train pipeline: ```bash @@ -299,5 +298,5 @@ Using Docker recommendation pipeline $ docker run --rm -it \ -v :/in \ -v :/out \ - yegor256/aibolit-image + cqfn/aibolit-image ``` diff --git a/aibolit/__main__.py b/aibolit/__main__.py index 5cf63f1a..56d1e6f7 100644 --- a/aibolit/__main__.py +++ b/aibolit/__main__.py @@ -33,10 +33,13 @@ import sys import time import traceback +from collections import defaultdict from os import scandir from pathlib import Path from sys import stdout -from typing import List +from typing import List, Any, Dict, Tuple + +import javalang import numpy as np # type: ignore import requests from lxml import etree # type: ignore @@ -45,7 +48,6 @@ from aibolit import __version__ from aibolit.config import Config from aibolit.ml_pipeline.ml_pipeline import train_process, collect_dataset -from aibolit.model.model import TwoFoldRankingModel, Dataset # type: ignore # noqa: F401 dir_path = os.path.dirname(os.path.realpath(__file__)) @@ -159,6 +161,90 @@ def __count_value(value_dict, input_params, code_lines_dict, java_file: str, is_ ) +def flatten(l): + return [item for sublist in l for item in sublist] + + +def add_pattern_if_ignored( + dct: Dict[str, Any], + pattern_item: Dict[Any, Any], + results_list: List[Any]) -> None: + """ If pattern code is not ignored, add it to the result list + + :param dct: dict, where key is pattern, value is list of lines range to ignore + :param pattern_item: pattern dict which was get after `inference` function + :param results_list: result list to add + + """ + ignored_lines = dct.get(pattern_item['pattern_code']) + if ignored_lines: + for place in ignored_lines: + # get lines range of ignored code + start_line_to_ignore = place[0] + end_line_to_ignore = place[1] + new_code_lines = [] + for line in pattern_item['code_lines']: + if (line >= start_line_to_ignore) and (line <= end_line_to_ignore): + continue + else: + new_code_lines.append(line) + pattern_item['code_lines'] = new_code_lines + if len(pattern_item['code_lines']) > 0: + results_list.append(pattern_item) + else: + results_list.append(pattern_item) + + +def find_annotation_by_node_type( + tree: javalang.tree.CompilationUnit, + node_type) -> Dict[Any, Any]: + """Search nodes with annotations. + + :param tree: javalang.tree + :param node_type: Node type of javalang.tree + :return + dict with annotations, where key is node, value is list of string annotations; + """ + annonations = defaultdict(list) + for _, node in tree.filter(node_type): + if node.annotations: + for a in node.annotations: + if hasattr(a.element, 'value'): + if 'aibolit' in a.element.value: + annonations[node].append( + a.element.value.split('.')[1].rstrip('\"') + ) + elif hasattr(a.element, 'values'): + for j in a.element.values: + if 'aibolit' in j.value: + annonations[node].append( + j.value.split('.')[1].rstrip('\"') + ) + return annonations + + +def find_start_and_end_lines(node) -> Tuple[int, int]: + max_line = node.position.line + + def traverse(node): + if hasattr(node, 'children'): + for child in node.children: + if isinstance(child, list) and (len(child) > 0): + for item in child: + traverse(item) + else: + if hasattr(child, '_position'): + nonlocal max_line + if child._position.line > max_line: + max_line = child._position.line + return + else: + return + + traverse(node) + return node.position.line, max_line + + def calculate_patterns_and_metrics(file, args): code_lines_dict = input_params = {} # type: ignore error_string = None @@ -586,12 +672,11 @@ def handle_exclude_command_line(args): def format_converter_for_pattern(results, sorted_by=None): - """Reformat data where data are sorted by patterns importance + """ + Reformat data where data are sorted by patterns importance (it is already sorted in the input). - Then lines are sorted in ascending order.""" - - def flatten(l): - return [item for sublist in l for item in sublist] + Then lines are sorted in ascending order. + """ for file in results: items = file.get('results') diff --git a/aibolit/ast_framework/ast.py b/aibolit/ast_framework/ast.py index 9a73cb21..ce86351a 100644 --- a/aibolit/ast_framework/ast.py +++ b/aibolit/ast_framework/ast.py @@ -35,6 +35,8 @@ MemberReferenceParams = namedtuple('MemberReferenceParams', ('object_name', 'member_name', 'unary_operator')) +BinaryOperationParams = namedtuple('BinaryOperationParams', ('operation', 'left_side', 'right_side')) + class AST: _NODE_SKIPED = -1 @@ -179,6 +181,11 @@ def get_member_reference_params(self, member_reference_node: int) -> MemberRefer return member_reference_params + def get_binary_operation_params(self, binary_operation_node: int) -> BinaryOperationParams: + assert(self.get_type(binary_operation_node) == ASTNodeType.BINARY_OPERATION) + operation_node, left_side_node, right_side_node = self.tree.succ[binary_operation_node] + return BinaryOperationParams(self.get_attr(operation_node, 'string'), left_side_node, right_side_node) + @staticmethod def _build_from_javalang(tree: DiGraph, javalang_node: Node) -> int: node_index = len(tree) + 1 diff --git a/aibolit/metrics/cognitiveC/cognitive_c.py b/aibolit/metrics/cognitiveC/cognitive_c.py index c9856891..a1cb04ed 100644 --- a/aibolit/metrics/cognitiveC/cognitive_c.py +++ b/aibolit/metrics/cognitiveC/cognitive_c.py @@ -1,132 +1,152 @@ -from javalang.tree import IfStatement, SwitchStatement, ForStatement, WhileStatement -from javalang.tree import DoStatement, CatchClause, BreakStatement, ContinueStatement -from javalang.tree import TernaryExpression, BinaryOperation, MethodDeclaration, MethodInvocation -import javalang -from typing import List, Any, Type - -from aibolit.utils.ast_builder import build_ast - - -increment_for: List[Type] = [ - IfStatement, - SwitchStatement, - ForStatement, - WhileStatement, - DoStatement, - CatchClause, - BreakStatement, - ContinueStatement, - TernaryExpression, - BinaryOperation, - MethodInvocation, -] - -nested_for: List[Type] = [ - IfStatement, - SwitchStatement, - ForStatement, - WhileStatement, - DoStatement, - CatchClause, -] - -logical_operators: List[str] = ['&', '&&', '^', '|', '||'] +from itertools import groupby +from aibolit.ast_framework import AST, ASTNodeType +from aibolit.ast_framework.java_package import JavaPackage +from typing import List, Set +import re + +only_increment_for: Set[ASTNodeType] = set([ + ASTNodeType.BREAK_STATEMENT, + ASTNodeType.CONTINUE_STATEMENT, + ASTNodeType.TERNARY_EXPRESSION, + ASTNodeType.BINARY_OPERATION, + ASTNodeType.METHOD_INVOCATION, +]) + +increment_and_nested_for: Set[ASTNodeType] = set([ + ASTNodeType.IF_STATEMENT, + ASTNodeType.SWITCH_STATEMENT, + ASTNodeType.FOR_STATEMENT, + ASTNodeType.WHILE_STATEMENT, + ASTNodeType.DO_STATEMENT, + ASTNodeType.CATCH_CLAUSE, +]) + +logical_operators = ['&&', '||'] class CognitiveComplexity: - ''' - beta version of Cognitive Complexity - ''' - def __init__(self): - self.complexity = 0 - self.method_name = None - def _traverse_childs(self, block: Any, nested_level: int) -> None: + def __init__(self): + # store the name for the considered method declaration + self.__method_name = None - for each_child in block.children: - self._get_complexity(each_child, nested_level) + def _traverse_childs(self, ast: AST, node: int, nested_level: int) -> int: + complexity = 0 + for each_child in ast.tree.succ[node]: + complexity += self._get_complexity(ast, each_child, nested_level) + return complexity - def _check_if_statement(self, expr: IfStatement, nested_level: int) -> None: + def _check_if_statement(self, ast, expr, nested_level: int) -> int: '''function to work with IfStatement block''' - self._get_complexity(expr.condition, 0) - if expr.then_statement is not None: - self.complexity += nested_level + 1 - self._get_complexity(expr.then_statement, nested_level + 1) - - if expr.else_statement is not None: - if isinstance(expr.else_statement, IfStatement): - self.complexity -= nested_level - self._check_if_statement(expr.else_statement, nested_level) + complexity = 0 + all_childs = list([i for i in ast.tree.succ[expr]]) + complexity += self._get_complexity(ast, all_childs[0], 0) + if len(all_childs) >= 2: + complexity += nested_level + 1 + complexity += self._get_complexity(ast, all_childs[1], nested_level + 1) + + if len(all_childs) == 3: + if ast.get_type(all_childs[2]) == ASTNodeType.IF_STATEMENT: + complexity -= nested_level + complexity += self._check_if_statement(ast, all_childs[2], nested_level) else: - self.complexity += 1 - self._get_complexity(expr.else_statement, nested_level + 1) - - def _increment_logical_operators(self, block: BinaryOperation, prev_operator: str) -> None: - for each_block in [block.operandr, block.operandl]: - - if isinstance(each_block, BinaryOperation) and prev_operator in logical_operators: - if prev_operator != each_block.operator: - self.complexity += 1 - - elif isinstance(each_block.operandr, BinaryOperation): - self.complexity += 1 - - self._increment_logical_operators(each_block, each_block.operator) - - def _is_recursion_call(self, block: MethodInvocation) -> bool: - if self.method_name == block.member: + complexity += 1 + complexity += self._get_complexity(ast, all_childs[2], nested_level + 1) + return complexity + + def _increment_logical_operators(self, ast: AST, binary_operation_node: int) -> int: + complexity = 0 + logical_operators_sequence = self._create_logical_operators_sequence(ast, binary_operation_node) + complexity += len(list(groupby(logical_operators_sequence))) + return complexity + + def _create_logical_operators_sequence(self, ast: AST, binary_operation_node: int) -> List[str]: + if ast.get_type(binary_operation_node) != ASTNodeType.BINARY_OPERATION: + return [] + + operator, left_side_node, right_side_node = ast.get_binary_operation_params(binary_operation_node) + if operator not in logical_operators: + return [] + + left_sequence = self._create_logical_operators_sequence(ast, left_side_node) + right_sequence = self._create_logical_operators_sequence(ast, right_side_node) + return left_sequence + [operator] + right_sequence + + def _is_recursion_call(self, ast, node) -> bool: + assert(ast.get_type(node) == ASTNodeType.METHOD_INVOCATION) + if self.__method_name == self._get_node_name(ast, node): return True return False - def _nested_methods(self, block: MethodDeclaration, nested_level: int) -> None: - original_name = self.method_name - self.method_name = block.name - self._get_complexity(block, nested_level + 1) - self.method_name = original_name - - def _get_complexity(self, block: Any, nested_level: int) -> None: - block_arr = block if isinstance(block, List) else [block] - - for each_block in block_arr: - if hasattr(each_block, 'children'): - - if type(each_block) == MethodDeclaration and each_block.name != self.method_name: - self._nested_methods(each_block, nested_level) - - elif isinstance(each_block, IfStatement): - self._check_if_statement(each_block, nested_level) - - elif type(each_block) in increment_for and type(each_block) in nested_for: - self.complexity += 1 + nested_level - self._traverse_childs(each_block, nested_level + 1) - - elif type(each_block) in increment_for and type(each_block) not in nested_for: - if isinstance(each_block, BinaryOperation): - if each_block.operator in logical_operators: - self.complexity += 1 - self._increment_logical_operators(each_block, each_block.operator) - - elif isinstance(each_block, MethodInvocation): - is_recursion = self._is_recursion_call(each_block) - self.complexity += is_recursion - - else: - self.complexity += 1 - self._traverse_childs(each_block, nested_level) - - else: - self._traverse_childs(each_block, nested_level) + def _nested_methods(self, ast, node, nested_level: int) -> int: + complexity = 0 + original_name = self.__method_name + self.__method_name = self._get_node_name(ast, node) + complexity += self._get_complexity(ast, node, nested_level + 1) + self.__method_name = original_name + return complexity + + def _process_not_nested_structure(self, ast: AST, each_block: int, nested_level: int) -> int: + complexity = 0 + each_block_type = ast.get_type(each_block) + if each_block_type == ASTNodeType.BINARY_OPERATION: + bin_operator = ast.get_binary_operation_name(each_block) + if bin_operator in logical_operators: + complexity += self._increment_logical_operators(ast, each_block) + + elif each_block_type == ASTNodeType.METHOD_INVOCATION: + is_recursion = self._is_recursion_call(ast, each_block) + complexity += is_recursion + + else: + complexity += 1 + complexity += self._traverse_childs(ast, each_block, nested_level) + + return complexity + + def _get_complexity(self, ast: AST, each_block: int, nested_level: int) -> int: + each_block_name = self._get_node_name(ast, each_block) + each_block_type = ast.get_type(each_block) + complexity = 0 + + if each_block_type == ASTNodeType.METHOD_DECLARATION and each_block_name != self.__method_name: + complexity += self._nested_methods(ast, each_block, nested_level) + + elif each_block_type == ASTNodeType.IF_STATEMENT: + complexity += self._check_if_statement(ast, each_block, nested_level) + + elif each_block_type in increment_and_nested_for: + complexity += 1 + nested_level + complexity += self._traverse_childs(ast, each_block, nested_level + 1) + + elif each_block_type in only_increment_for: + complexity += self._process_not_nested_structure(ast, each_block, nested_level) + + else: + complexity += self._traverse_childs(ast, each_block, nested_level) + return complexity + + def _get_node_name(self, ast, node) -> str: + extracted_name = None + names = ast.children_with_type(node, ASTNodeType.STRING) + for each_string in names: + method_name = ast.get_attr(each_string, 'string') + # Checking not to start with '/' is aimed to get + # rid of comments, which are all childs of node. + # We check the occurance any letter in name in order + # to get rid of '' string and None. + if not method_name.startswith('/') and re.search(r'[^\W\d]', method_name) is not None: + extracted_name = method_name + return extracted_name + return '' def value(self, filename: str) -> int: - - tree = build_ast(filename) - for _, class_body in tree.filter(javalang.tree.ClassDeclaration): - for each_object in class_body.body: - if isinstance(each_object, MethodDeclaration): - - # memorize the name for detecting recursion call - self.method_name = each_object.name - self._get_complexity(each_object, 0) - - final_value, self.complexity = self.complexity, 0 - return final_value + complexity = 0 + p = JavaPackage(filename) + for class_name in p.java_classes: + tree = p.java_classes[class_name] + for method_set in tree.methods.values(): + for method_ast in method_set: + self.__method_name = self._get_node_name(method_ast, method_ast.root) + complexity += self._get_complexity(method_ast, method_ast.root, 0) + return complexity diff --git a/aibolit/patterns/if_return_if_detection/if_detection.py b/aibolit/patterns/if_return_if_detection/if_detection.py index b4296bec..65f28da3 100644 --- a/aibolit/patterns/if_return_if_detection/if_detection.py +++ b/aibolit/patterns/if_return_if_detection/if_detection.py @@ -1,19 +1,6 @@ -import javalang -from aibolit.utils.java_parser import JavalangImproved - - -class newJavalangImproved(JavalangImproved): - - def filter(self, ntypes): - nodes = self.tree_to_nodes() - array = [] - for index, i in enumerate(nodes): - if (type(i.node) in ntypes): - if type(i.node.then_statement) in [javalang.tree.BlockStatement] and i.node.else_statement is not None: - for check_return in i.node.then_statement.statements: - if type(check_return) in [javalang.tree.ReturnStatement]: - array.append(nodes[index].line) - return array +from aibolit.ast_framework import ASTNodeType +from aibolit.ast_framework.java_package import JavaPackage +from typing import List class CountIfReturn: @@ -24,9 +11,15 @@ class CountIfReturn: def __init__(self): pass - def value(self, filename: str): - '''''' - tree = newJavalangImproved(filename) - if_decls = tree.filter([javalang.tree.IfStatement]) - - return if_decls + def value(self, filename: str) -> List[int]: + detected_lines = [] + ast = JavaPackage(filename).java_classes + for class_name in ast: + java_class = ast[class_name] + for index, if_node in enumerate(java_class.nodes_by_type(ASTNodeType.IF_STATEMENT)): + all_childs = [i for i in java_class.tree.succ[if_node]] + if len(all_childs) == 3: + for i in java_class.tree.succ[all_childs[1]]: + if java_class.get_type(i) == ASTNodeType.RETURN_STATEMENT: + detected_lines += [java_class.get_attr(if_node, 'source_code_line')] + return detected_lines diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 1fef06ba..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM jupyter/datascience-notebook - -RUN wget -q https://github.com/yegor256/aibolit/releases/download/v1.0.0/dataset.zip -RUN wget -q https://github.com/yegor256/aibolit/releases/download/v1.0.0/halstead.jar -RUN wget -q https://github.com/yegor256/aibolit/releases/download/v1.0.0/pmd-bin.zip - -RUN pip install torch==1.5.0 catboost==0.22 pandas==1.0.0 mypy==0.770 -RUN pip install networkx==2.4 lightgbm==2.3.1 scikit-learn==0.22.1 sphinx==2.3.1 -RUN git config --global user.email "docker@example.com" -RUN git config --global user.name "Docker Dockerovich" -RUN git config --global core.editor "vim" - -USER root -RUN apt-get -y update && apt-get -y install vim -RUN apt-get -y install default-jdk maven - -USER jovyan -RUN mkdir _tmp -RUN mkdir java_files -RUN unzip -q dataset.zip -d ./java_files -ENV JAVA_FILES_PATH /home/jovyan/java_files -ENTRYPOINT [] \ No newline at end of file diff --git a/docker/Dockerfile.recommend b/docker/Dockerfile.recommend deleted file mode 100644 index f594afe9..00000000 --- a/docker/Dockerfile.recommend +++ /dev/null @@ -1,15 +0,0 @@ -FROM python - -RUN git config --global user.email "docker@example.com" -RUN git config --global user.name "Docker Dockerovich" - -# fetch and install Aibolit from source# -ADD ./git_clone_and_pull_pr.sh . -RUN chmod +x ./git_clone_and_pull_pr.sh -RUN ./git_clone_and_pull_pr.sh - -RUN mkdir in -RUN mkdir out - -ENTRYPOINT [] -CMD ["aibolit", "recommend", "--folder=./in", "--output=./out/out.xml"] \ No newline at end of file diff --git a/docker/git_clone_and_pull_pr.sh b/docker/git_clone_and_pull_pr.sh deleted file mode 100644 index 45435af3..00000000 --- a/docker/git_clone_and_pull_pr.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -echo "Fetch Aibolit sources" - -DEFAULT_BRANCH=master -export PULL_ID -export GIT_BRANCH - -GIT_BRANCH=${GIT_BRANCH:-$DEFAULT_BRANCH} - -is_pull_id () [[ -n $PULL_ID ]] - -if [ -z ${PULL_ID+x} ]; then echo "PULL_ID is unset."; else echo "PULL_ID is set to '$PULL_ID'"; fi - -git clone --single-branch --branch $GIT_BRANCH https://github.com/yegor256/aibolit -cd aibolit -is_pull_id && git pull --no-edit origin pull/$PULL_ID/head -pip install -e . -mkdir -p ./scripts/target \ No newline at end of file diff --git a/test/integration/samples/AbstractCommand.java b/test/integration/samples/AbstractCommand.java index 41a6cb54..b84678f8 100644 --- a/test/integration/samples/AbstractCommand.java +++ b/test/integration/samples/AbstractCommand.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ActionHistory.java b/test/integration/samples/ActionHistory.java index 9d8d66bd..b3f9d5de 100644 --- a/test/integration/samples/ActionHistory.java +++ b/test/integration/samples/ActionHistory.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others diff --git a/test/integration/samples/AddActionPanel.java b/test/integration/samples/AddActionPanel.java index b3a8f443..b85d1a2c 100644 --- a/test/integration/samples/AddActionPanel.java +++ b/test/integration/samples/AddActionPanel.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/AddFIActionPanel.java b/test/integration/samples/AddFIActionPanel.java index e8c93628..857256cc 100644 --- a/test/integration/samples/AddFIActionPanel.java +++ b/test/integration/samples/AddFIActionPanel.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/AnnotationOffsetItem.java b/test/integration/samples/AnnotationOffsetItem.java index 2ae944dd..b3b0ca5e 100644 --- a/test/integration/samples/AnnotationOffsetItem.java +++ b/test/integration/samples/AnnotationOffsetItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/AnnotationSetReferenceItem.java b/test/integration/samples/AnnotationSetReferenceItem.java index a6b20050..0fc24106 100644 --- a/test/integration/samples/AnnotationSetReferenceItem.java +++ b/test/integration/samples/AnnotationSetReferenceItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/AnnotationsDirectoryItem.java b/test/integration/samples/AnnotationsDirectoryItem.java index 853c6b83..b059ed4f 100644 --- a/test/integration/samples/AnnotationsDirectoryItem.java +++ b/test/integration/samples/AnnotationsDirectoryItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/Assertions.java b/test/integration/samples/Assertions.java index 8783101d..d5fb295c 100644 --- a/test/integration/samples/Assertions.java +++ b/test/integration/samples/Assertions.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/AttrProp.java b/test/integration/samples/AttrProp.java index d7e768a0..c343d6c2 100644 --- a/test/integration/samples/AttrProp.java +++ b/test/integration/samples/AttrProp.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BCFile.java b/test/integration/samples/BCFile.java index 43d82993..5c98ed71 100644 --- a/test/integration/samples/BCFile.java +++ b/test/integration/samples/BCFile.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with this diff --git a/test/integration/samples/BaseKit.java b/test/integration/samples/BaseKit.java index cd1ba15c..d4ce54fc 100644 --- a/test/integration/samples/BaseKit.java +++ b/test/integration/samples/BaseKit.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BeanCodeManager.java b/test/integration/samples/BeanCodeManager.java index d60747ff..251f2708 100644 --- a/test/integration/samples/BeanCodeManager.java +++ b/test/integration/samples/BeanCodeManager.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BellmanFordAdjacencyMatrix.java b/test/integration/samples/BellmanFordAdjacencyMatrix.java index e14357a0..58882e5a 100644 --- a/test/integration/samples/BellmanFordAdjacencyMatrix.java +++ b/test/integration/samples/BellmanFordAdjacencyMatrix.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * An implementation of the Bellman-Ford algorithm. The algorithm finds the shortest path between a * starting node and all other nodes in the graph. The algorithm also detects negative cycles. diff --git a/test/integration/samples/BiAnalyser.java b/test/integration/samples/BiAnalyser.java index 14a23347..c21d2cb6 100644 --- a/test/integration/samples/BiAnalyser.java +++ b/test/integration/samples/BiAnalyser.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BinaryHeap.java b/test/integration/samples/BinaryHeap.java index 750af44d..b8c25100 100644 --- a/test/integration/samples/BinaryHeap.java +++ b/test/integration/samples/BinaryHeap.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * A min priority queue implementation using a binary heap. * diff --git a/test/integration/samples/BinaryHeapQuickRemovals.java b/test/integration/samples/BinaryHeapQuickRemovals.java index 3c914fd5..9bd8f233 100644 --- a/test/integration/samples/BinaryHeapQuickRemovals.java +++ b/test/integration/samples/BinaryHeapQuickRemovals.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * A min priority queue implementation using a binary heap. This implementation tracks each element * inside the binary heap with a hashtable for quick removals. diff --git a/test/integration/samples/BlockReaderLocal.java b/test/integration/samples/BlockReaderLocal.java index 9c1ef461..54746812 100644 --- a/test/integration/samples/BlockReaderLocal.java +++ b/test/integration/samples/BlockReaderLocal.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BlockReaderLocalLegacy.java b/test/integration/samples/BlockReaderLocalLegacy.java index e48ace6c..f2918eba 100644 --- a/test/integration/samples/BlockReaderLocalLegacy.java +++ b/test/integration/samples/BlockReaderLocalLegacy.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/BreakpointsTreeModel.java b/test/integration/samples/BreakpointsTreeModel.java index d1c71288..2d2b5fd9 100644 --- a/test/integration/samples/BreakpointsTreeModel.java +++ b/test/integration/samples/BreakpointsTreeModel.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ChainedBuffer.java b/test/integration/samples/ChainedBuffer.java index 8fc65bf0..6de95cbc 100644 --- a/test/integration/samples/ChainedBuffer.java +++ b/test/integration/samples/ChainedBuffer.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ChatEndpoint.java b/test/integration/samples/ChatEndpoint.java index c4e20f4b..acf2e476 100644 --- a/test/integration/samples/ChatEndpoint.java +++ b/test/integration/samples/ChatEndpoint.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.baeldung.websocket; import java.io.IOException; diff --git a/test/integration/samples/ClassDefItem.java b/test/integration/samples/ClassDefItem.java index e5c38e8a..cc519bcf 100644 --- a/test/integration/samples/ClassDefItem.java +++ b/test/integration/samples/ClassDefItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/CleanupQueue.java b/test/integration/samples/CleanupQueue.java index a40a40ad..3e63c2b1 100644 --- a/test/integration/samples/CleanupQueue.java +++ b/test/integration/samples/CleanupQueue.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ClipboardHandler.java b/test/integration/samples/ClipboardHandler.java index 78def107..f7b9e73e 100644 --- a/test/integration/samples/ClipboardHandler.java +++ b/test/integration/samples/ClipboardHandler.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ClusterSizeMonitor.java b/test/integration/samples/ClusterSizeMonitor.java index 83bcb446..3d695b66 100644 --- a/test/integration/samples/ClusterSizeMonitor.java +++ b/test/integration/samples/ClusterSizeMonitor.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/integration/samples/CodeItem.java b/test/integration/samples/CodeItem.java index 0f75f22b..86f787a2 100644 --- a/test/integration/samples/CodeItem.java +++ b/test/integration/samples/CodeItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/CompactMap.java b/test/integration/samples/CompactMap.java index 4a6f17d6..6e1648bf 100644 --- a/test/integration/samples/CompactMap.java +++ b/test/integration/samples/CompactMap.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/CompactSegmentTree.java b/test/integration/samples/CompactSegmentTree.java index d7352d86..7a286b00 100644 --- a/test/integration/samples/CompactSegmentTree.java +++ b/test/integration/samples/CompactSegmentTree.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * A compact array based segment tree implementation. This segment tree supports point updates and * range queries. diff --git a/test/integration/samples/ConditionalExpressionCheck.java b/test/integration/samples/ConditionalExpressionCheck.java index 451a1af2..46a9c118 100644 --- a/test/integration/samples/ConditionalExpressionCheck.java +++ b/test/integration/samples/ConditionalExpressionCheck.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.huawei.codecheck.customchecks; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; diff --git a/test/integration/samples/Configuration.java b/test/integration/samples/Configuration.java index 5119f648..f8966bd5 100644 --- a/test/integration/samples/Configuration.java +++ b/test/integration/samples/Configuration.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ConsoleImpl.java b/test/integration/samples/ConsoleImpl.java index 65537a69..a4bf82b4 100644 --- a/test/integration/samples/ConsoleImpl.java +++ b/test/integration/samples/ConsoleImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.stardust.autojs.core.console; import android.content.Context; diff --git a/test/integration/samples/ConsumerImpl.java b/test/integration/samples/ConsumerImpl.java index 33f05192..6d73ad6c 100644 --- a/test/integration/samples/ConsumerImpl.java +++ b/test/integration/samples/ConsumerImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/DBHandle.java b/test/integration/samples/DBHandle.java index a99a3a43..7465e917 100644 --- a/test/integration/samples/DBHandle.java +++ b/test/integration/samples/DBHandle.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DBParms.java b/test/integration/samples/DBParms.java index 6fe402be..002ec2da 100644 --- a/test/integration/samples/DBParms.java +++ b/test/integration/samples/DBParms.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * REVIEWED: YES diff --git a/test/integration/samples/DDParser.java b/test/integration/samples/DDParser.java index b0474922..02f7e937 100644 --- a/test/integration/samples/DDParser.java +++ b/test/integration/samples/DDParser.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/DataTypeArchiveDB.java b/test/integration/samples/DataTypeArchiveDB.java index 1d9acbbe..3cddc492 100644 --- a/test/integration/samples/DataTypeArchiveDB.java +++ b/test/integration/samples/DataTypeArchiveDB.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DeadlockExample.java b/test/integration/samples/DeadlockExample.java index b7b65d11..78d056c1 100644 --- a/test/integration/samples/DeadlockExample.java +++ b/test/integration/samples/DeadlockExample.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.baeldung.commonissues; public class DeadlockExample { diff --git a/test/integration/samples/DecompileDebug.java b/test/integration/samples/DecompileDebug.java index a19dccd5..c1ce8af0 100644 --- a/test/integration/samples/DecompileDebug.java +++ b/test/integration/samples/DecompileDebug.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DefaultEMLookup.java b/test/integration/samples/DefaultEMLookup.java index b569b432..7b95648b 100644 --- a/test/integration/samples/DefaultEMLookup.java +++ b/test/integration/samples/DefaultEMLookup.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/DefaultProject.java b/test/integration/samples/DefaultProject.java index 6e53c4e8..feb3c370 100644 --- a/test/integration/samples/DefaultProject.java +++ b/test/integration/samples/DefaultProject.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DependencyGraph.java b/test/integration/samples/DependencyGraph.java index c58582f8..ad6d8141 100644 --- a/test/integration/samples/DependencyGraph.java +++ b/test/integration/samples/DependencyGraph.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DeterministicDependencyGraph.java b/test/integration/samples/DeterministicDependencyGraph.java index 523d084e..62ca1199 100644 --- a/test/integration/samples/DeterministicDependencyGraph.java +++ b/test/integration/samples/DeterministicDependencyGraph.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/DriverYieldSignal.java b/test/integration/samples/DriverYieldSignal.java index 45d17815..10799cb8 100644 --- a/test/integration/samples/DriverYieldSignal.java +++ b/test/integration/samples/DriverYieldSignal.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/integration/samples/EncodedMethod.java b/test/integration/samples/EncodedMethod.java index d4abcd49..4b4b1a45 100644 --- a/test/integration/samples/EncodedMethod.java +++ b/test/integration/samples/EncodedMethod.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/Environment.java b/test/integration/samples/Environment.java index bc92b714..b0ac6ba8 100644 --- a/test/integration/samples/Environment.java +++ b/test/integration/samples/Environment.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/EpollEventLoop.java b/test/integration/samples/EpollEventLoop.java index 526276cc..e9c674e0 100644 --- a/test/integration/samples/EpollEventLoop.java +++ b/test/integration/samples/EpollEventLoop.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2014 The Netty Project * diff --git a/test/integration/samples/ExceptionDemo.java b/test/integration/samples/ExceptionDemo.java index 7b4bdf46..979f4d53 100644 --- a/test/integration/samples/ExceptionDemo.java +++ b/test/integration/samples/ExceptionDemo.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package cn.itcast_02; /* diff --git a/test/integration/samples/FieldAnnotation.java b/test/integration/samples/FieldAnnotation.java index 0832429e..c38cd535 100644 --- a/test/integration/samples/FieldAnnotation.java +++ b/test/integration/samples/FieldAnnotation.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/FoldViewFactory.java b/test/integration/samples/FoldViewFactory.java index 1c91044c..0b139d2d 100644 --- a/test/integration/samples/FoldViewFactory.java +++ b/test/integration/samples/FoldViewFactory.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/FutureStateChange.java b/test/integration/samples/FutureStateChange.java index 1a3a3d75..d5e08cac 100644 --- a/test/integration/samples/FutureStateChange.java +++ b/test/integration/samples/FutureStateChange.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/integration/samples/GeneticAlgorithm_travelingSalesman.java b/test/integration/samples/GeneticAlgorithm_travelingSalesman.java index 6923cd61..11b77ecd 100644 --- a/test/integration/samples/GeneticAlgorithm_travelingSalesman.java +++ b/test/integration/samples/GeneticAlgorithm_travelingSalesman.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * An implementation of the TSP problem using a genetic algorithm. This implementation works well * for graph with < 30 nodes, beyond this it seems to struggle getting near the optimal solution. diff --git a/test/integration/samples/HyperlinkEnv.java b/test/integration/samples/HyperlinkEnv.java index e676faec..bca3029e 100644 --- a/test/integration/samples/HyperlinkEnv.java +++ b/test/integration/samples/HyperlinkEnv.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/IconListPreference.java b/test/integration/samples/IconListPreference.java index 78b83252..7601f12c 100644 --- a/test/integration/samples/IconListPreference.java +++ b/test/integration/samples/IconListPreference.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.kunfei.bookshelf.widget.prefs; import android.annotation.SuppressLint; diff --git a/test/integration/samples/IndexedLocalFileSystem.java b/test/integration/samples/IndexedLocalFileSystem.java index 8aa03203..3014f770 100644 --- a/test/integration/samples/IndexedLocalFileSystem.java +++ b/test/integration/samples/IndexedLocalFileSystem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/IndicesClusterStateService.java b/test/integration/samples/IndicesClusterStateService.java index 754635b1..0752e3ec 100644 --- a/test/integration/samples/IndicesClusterStateService.java +++ b/test/integration/samples/IndicesClusterStateService.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/IntKeyMap.java b/test/integration/samples/IntKeyMap.java index 6847a376..3a8551f4 100644 --- a/test/integration/samples/IntKeyMap.java +++ b/test/integration/samples/IntKeyMap.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others diff --git a/test/integration/samples/InternalEngine.java b/test/integration/samples/InternalEngine.java index c73ecbc8..2094b880 100644 --- a/test/integration/samples/InternalEngine.java +++ b/test/integration/samples/InternalEngine.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/InterpDtTerm.java b/test/integration/samples/InterpDtTerm.java index 988781dd..c895b3b6 100644 --- a/test/integration/samples/InterpDtTerm.java +++ b/test/integration/samples/InterpDtTerm.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/InterpProtoANSI.java b/test/integration/samples/InterpProtoANSI.java index 37579e72..1e105ee5 100644 --- a/test/integration/samples/InterpProtoANSI.java +++ b/test/integration/samples/InterpProtoANSI.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/InterpProtoANSIX.java b/test/integration/samples/InterpProtoANSIX.java index 38098079..af8d5643 100644 --- a/test/integration/samples/InterpProtoANSIX.java +++ b/test/integration/samples/InterpProtoANSIX.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/InterpXTerm.java b/test/integration/samples/InterpXTerm.java index ef442394..ee22c6d5 100644 --- a/test/integration/samples/InterpXTerm.java +++ b/test/integration/samples/InterpXTerm.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/JShellEnvironment.java b/test/integration/samples/JShellEnvironment.java index 2a3bc153..666c5e0d 100644 --- a/test/integration/samples/JShellEnvironment.java +++ b/test/integration/samples/JShellEnvironment.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/JavaTargetChooserPanelGUI.java b/test/integration/samples/JavaTargetChooserPanelGUI.java index a99fffd6..1753389d 100644 --- a/test/integration/samples/JavaTargetChooserPanelGUI.java +++ b/test/integration/samples/JavaTargetChooserPanelGUI.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/JdbcResultsSnapshot.java b/test/integration/samples/JdbcResultsSnapshot.java index ff5fea87..3ae5bd8f 100644 --- a/test/integration/samples/JdbcResultsSnapshot.java +++ b/test/integration/samples/JdbcResultsSnapshot.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/KeyStrokeEditor.java b/test/integration/samples/KeyStrokeEditor.java index 2c846576..da11b202 100644 --- a/test/integration/samples/KeyStrokeEditor.java +++ b/test/integration/samples/KeyStrokeEditor.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/LSPBindings.java b/test/integration/samples/LSPBindings.java index c45b117c..c0bc97ce 100644 --- a/test/integration/samples/LSPBindings.java +++ b/test/integration/samples/LSPBindings.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/LiveMemoryViewUpdater.java b/test/integration/samples/LiveMemoryViewUpdater.java index 46ed6f66..734dc34b 100644 --- a/test/integration/samples/LiveMemoryViewUpdater.java +++ b/test/integration/samples/LiveMemoryViewUpdater.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/LoaderInfoHeader.java b/test/integration/samples/LoaderInfoHeader.java index f2553cd3..11e30590 100644 --- a/test/integration/samples/LoaderInfoHeader.java +++ b/test/integration/samples/LoaderInfoHeader.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/LoaderRelocationHeader.java b/test/integration/samples/LoaderRelocationHeader.java index f6f5d5d2..ca19de79 100644 --- a/test/integration/samples/LoaderRelocationHeader.java +++ b/test/integration/samples/LoaderRelocationHeader.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/LocalDataFile.java b/test/integration/samples/LocalDataFile.java index 7778c9f8..01b5ef08 100644 --- a/test/integration/samples/LocalDataFile.java +++ b/test/integration/samples/LocalDataFile.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/LocalDatabaseItem.java b/test/integration/samples/LocalDatabaseItem.java index d8c52883..d31d8684 100644 --- a/test/integration/samples/LocalDatabaseItem.java +++ b/test/integration/samples/LocalDatabaseItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/LocalJobRunner.java b/test/integration/samples/LocalJobRunner.java index 0f1d759c..42c9d475 100644 --- a/test/integration/samples/LocalJobRunner.java +++ b/test/integration/samples/LocalJobRunner.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/LocalShardSnapshot.java b/test/integration/samples/LocalShardSnapshot.java index cc9ac40c..6241714c 100644 --- a/test/integration/samples/LocalShardSnapshot.java +++ b/test/integration/samples/LocalShardSnapshot.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/LocalizedBundleInfo.java b/test/integration/samples/LocalizedBundleInfo.java index dcd71072..6035d6eb 100644 --- a/test/integration/samples/LocalizedBundleInfo.java +++ b/test/integration/samples/LocalizedBundleInfo.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/LongKeyMap.java b/test/integration/samples/LongKeyMap.java index 3c64c2c4..a7627c00 100644 --- a/test/integration/samples/LongKeyMap.java +++ b/test/integration/samples/LongKeyMap.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others diff --git a/test/integration/samples/LongestCommonSubstring.java b/test/integration/samples/LongestCommonSubstring.java index f0718493..4cbe9c29 100644 --- a/test/integration/samples/LongestCommonSubstring.java +++ b/test/integration/samples/LongestCommonSubstring.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * An implementation of the k Longest Common Substring problem. * diff --git a/test/integration/samples/LottieImageAsset.java b/test/integration/samples/LottieImageAsset.java index 2c8f1d0b..7aff55ff 100644 --- a/test/integration/samples/LottieImageAsset.java +++ b/test/integration/samples/LottieImageAsset.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + package com.airbnb.lottie; import android.graphics.Bitmap; diff --git a/test/integration/samples/MessageDeduplication.java b/test/integration/samples/MessageDeduplication.java index dc4604e8..2de7b22c 100644 --- a/test/integration/samples/MessageDeduplication.java +++ b/test/integration/samples/MessageDeduplication.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/MethodAnnotation.java b/test/integration/samples/MethodAnnotation.java index 2679e34d..180cdb00 100644 --- a/test/integration/samples/MethodAnnotation.java +++ b/test/integration/samples/MethodAnnotation.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/MethodsFeatureModes.java b/test/integration/samples/MethodsFeatureModes.java index 117c3b09..6fe996db 100644 --- a/test/integration/samples/MethodsFeatureModes.java +++ b/test/integration/samples/MethodsFeatureModes.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/MfLexer.java b/test/integration/samples/MfLexer.java index d053cc2a..d02f10a7 100644 --- a/test/integration/samples/MfLexer.java +++ b/test/integration/samples/MfLexer.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ModifierEditor.java b/test/integration/samples/ModifierEditor.java index c473da3c..ef0398f3 100644 --- a/test/integration/samples/ModifierEditor.java +++ b/test/integration/samples/ModifierEditor.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ModuleClassPaths.java b/test/integration/samples/ModuleClassPaths.java index 65a27972..10fa3f65 100644 --- a/test/integration/samples/ModuleClassPaths.java +++ b/test/integration/samples/ModuleClassPaths.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ModuleConfigurationImpl.java b/test/integration/samples/ModuleConfigurationImpl.java index ef29a9dc..f6f033cf 100644 --- a/test/integration/samples/ModuleConfigurationImpl.java +++ b/test/integration/samples/ModuleConfigurationImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ModuleRoots.java b/test/integration/samples/ModuleRoots.java index 2c1a2ad5..308ef589 100644 --- a/test/integration/samples/ModuleRoots.java +++ b/test/integration/samples/ModuleRoots.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ModuleTargetChooserPanelGUI.java b/test/integration/samples/ModuleTargetChooserPanelGUI.java index 546c00b2..bc089fec 100644 --- a/test/integration/samples/ModuleTargetChooserPanelGUI.java +++ b/test/integration/samples/ModuleTargetChooserPanelGUI.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/MultiModuleClassPathProvider.java b/test/integration/samples/MultiModuleClassPathProvider.java index b77746c5..7cd47c47 100644 --- a/test/integration/samples/MultiModuleClassPathProvider.java +++ b/test/integration/samples/MultiModuleClassPathProvider.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NBClassReader.java b/test/integration/samples/NBClassReader.java index 062412f3..1a59c3aa 100644 --- a/test/integration/samples/NBClassReader.java +++ b/test/integration/samples/NBClassReader.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NativeRSRawDecoder.java b/test/integration/samples/NativeRSRawDecoder.java index dc2c33a6..abdf5ddf 100644 --- a/test/integration/samples/NativeRSRawDecoder.java +++ b/test/integration/samples/NativeRSRawDecoder.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NativeRSRawEncoder.java b/test/integration/samples/NativeRSRawEncoder.java index ad06927f..7fd05424 100644 --- a/test/integration/samples/NativeRSRawEncoder.java +++ b/test/integration/samples/NativeRSRawEncoder.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NativeXORRawDecoder.java b/test/integration/samples/NativeXORRawDecoder.java index dd708eb5..30ca0779 100644 --- a/test/integration/samples/NativeXORRawDecoder.java +++ b/test/integration/samples/NativeXORRawDecoder.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NativeXORRawEncoder.java b/test/integration/samples/NativeXORRawEncoder.java index 66b0a1bf..5fa6bfa1 100644 --- a/test/integration/samples/NativeXORRawEncoder.java +++ b/test/integration/samples/NativeXORRawEncoder.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/NodesReloadSecureSettingsRequest.java b/test/integration/samples/NodesReloadSecureSettingsRequest.java index 7796fba5..954ca3cc 100644 --- a/test/integration/samples/NodesReloadSecureSettingsRequest.java +++ b/test/integration/samples/NodesReloadSecureSettingsRequest.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/NonPersistentSubscription.java b/test/integration/samples/NonPersistentSubscription.java index 65204200..4fd25b0e 100644 --- a/test/integration/samples/NonPersistentSubscription.java +++ b/test/integration/samples/NonPersistentSubscription.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/OpenSslClientContext.java b/test/integration/samples/OpenSslClientContext.java index 7f9b39a8..206376cb 100644 --- a/test/integration/samples/OpenSslClientContext.java +++ b/test/integration/samples/OpenSslClientContext.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2014 The Netty Project * diff --git a/test/integration/samples/OpenSslServerContext.java b/test/integration/samples/OpenSslServerContext.java index da342de0..dbedcefc 100644 --- a/test/integration/samples/OpenSslServerContext.java +++ b/test/integration/samples/OpenSslServerContext.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2014 The Netty Project * diff --git a/test/integration/samples/OpenSslX509KeyManagerFactory.java b/test/integration/samples/OpenSslX509KeyManagerFactory.java index 2a86332f..b6d4b15c 100644 --- a/test/integration/samples/OpenSslX509KeyManagerFactory.java +++ b/test/integration/samples/OpenSslX509KeyManagerFactory.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2018 The Netty Project * diff --git a/test/integration/samples/OrPattern.java b/test/integration/samples/OrPattern.java index 01c3a3de..fe5e5d1e 100644 --- a/test/integration/samples/OrPattern.java +++ b/test/integration/samples/OrPattern.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * REVIEWED: YES diff --git a/test/integration/samples/OutputStreamPublisher.java b/test/integration/samples/OutputStreamPublisher.java index d168c1dd..a477448d 100644 --- a/test/integration/samples/OutputStreamPublisher.java +++ b/test/integration/samples/OutputStreamPublisher.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. * diff --git a/test/integration/samples/PackedDatabase.java b/test/integration/samples/PackedDatabase.java index 41bfd8c7..2467c4d6 100644 --- a/test/integration/samples/PackedDatabase.java +++ b/test/integration/samples/PackedDatabase.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ParameterAnnotation.java b/test/integration/samples/ParameterAnnotation.java index 1560c7b8..672a9bbf 100644 --- a/test/integration/samples/ParameterAnnotation.java +++ b/test/integration/samples/ParameterAnnotation.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/PartitionManager.java b/test/integration/samples/PartitionManager.java index 96d6ede6..a72789b7 100644 --- a/test/integration/samples/PartitionManager.java +++ b/test/integration/samples/PartitionManager.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. diff --git a/test/integration/samples/PdbInfo.java b/test/integration/samples/PdbInfo.java index 4abeab3c..49b18f5c 100644 --- a/test/integration/samples/PdbInfo.java +++ b/test/integration/samples/PdbInfo.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/PdbInfoDotNet.java b/test/integration/samples/PdbInfoDotNet.java index 27ff8eca..ba10ea62 100644 --- a/test/integration/samples/PdbInfoDotNet.java +++ b/test/integration/samples/PdbInfoDotNet.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/PersistentDispatcherMultipleConsumers.java b/test/integration/samples/PersistentDispatcherMultipleConsumers.java index 9c6b1efa..e76ae756 100644 --- a/test/integration/samples/PersistentDispatcherMultipleConsumers.java +++ b/test/integration/samples/PersistentDispatcherMultipleConsumers.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/PersistentDispatcherSingleActiveConsumer.java b/test/integration/samples/PersistentDispatcherSingleActiveConsumer.java index c29fbc85..3f424152 100644 --- a/test/integration/samples/PersistentDispatcherSingleActiveConsumer.java +++ b/test/integration/samples/PersistentDispatcherSingleActiveConsumer.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/PersistentSubscription.java b/test/integration/samples/PersistentSubscription.java index 88d8e45c..92983497 100644 --- a/test/integration/samples/PersistentSubscription.java +++ b/test/integration/samples/PersistentSubscription.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/PrestimeCPUCCTNodeBacked.java b/test/integration/samples/PrestimeCPUCCTNodeBacked.java index 7e021968..25e50b97 100644 --- a/test/integration/samples/PrestimeCPUCCTNodeBacked.java +++ b/test/integration/samples/PrestimeCPUCCTNodeBacked.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/PrivateDatabase.java b/test/integration/samples/PrivateDatabase.java index 372b9411..506d9c65 100644 --- a/test/integration/samples/PrivateDatabase.java +++ b/test/integration/samples/PrivateDatabase.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ProducerImpl.java b/test/integration/samples/ProducerImpl.java index 7805fa8d..369debb2 100644 --- a/test/integration/samples/ProducerImpl.java +++ b/test/integration/samples/ProducerImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ProfilerGCXYItemPainter.java b/test/integration/samples/ProfilerGCXYItemPainter.java index d0bd4406..4b397dcf 100644 --- a/test/integration/samples/ProfilerGCXYItemPainter.java +++ b/test/integration/samples/ProfilerGCXYItemPainter.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ProfilerTreeTable.java b/test/integration/samples/ProfilerTreeTable.java index 1e61b79b..b4078cd5 100644 --- a/test/integration/samples/ProfilerTreeTable.java +++ b/test/integration/samples/ProfilerTreeTable.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ProgramDB.java b/test/integration/samples/ProgramDB.java index 3679b238..83e41f35 100644 --- a/test/integration/samples/ProgramDB.java +++ b/test/integration/samples/ProgramDB.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ProgramUserDataDB.java b/test/integration/samples/ProgramUserDataDB.java index edb64097..973c8566 100644 --- a/test/integration/samples/ProgramUserDataDB.java +++ b/test/integration/samples/ProgramUserDataDB.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ProjectFileManager.java b/test/integration/samples/ProjectFileManager.java index 8ba125c7..50db831b 100644 --- a/test/integration/samples/ProjectFileManager.java +++ b/test/integration/samples/ProjectFileManager.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/PrototypesIDItem.java b/test/integration/samples/PrototypesIDItem.java index d10665ac..b59bc882 100644 --- a/test/integration/samples/PrototypesIDItem.java +++ b/test/integration/samples/PrototypesIDItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/PulsarBolt.java b/test/integration/samples/PulsarBolt.java index d331ca2e..2b4b10e4 100644 --- a/test/integration/samples/PulsarBolt.java +++ b/test/integration/samples/PulsarBolt.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/PulsarOffsetBackingStore.java b/test/integration/samples/PulsarOffsetBackingStore.java index d7daf82e..9c8d2624 100644 --- a/test/integration/samples/PulsarOffsetBackingStore.java +++ b/test/integration/samples/PulsarOffsetBackingStore.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/RecoveryMgr.java b/test/integration/samples/RecoveryMgr.java index 93cd0df7..2f5ef50e 100644 --- a/test/integration/samples/RecoveryMgr.java +++ b/test/integration/samples/RecoveryMgr.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/ReferenceCountedOpenSslClientContext.java b/test/integration/samples/ReferenceCountedOpenSslClientContext.java index 56893b3f..418333aa 100644 --- a/test/integration/samples/ReferenceCountedOpenSslClientContext.java +++ b/test/integration/samples/ReferenceCountedOpenSslClientContext.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2016 The Netty Project * diff --git a/test/integration/samples/ReferenceCountedOpenSslEngine.java b/test/integration/samples/ReferenceCountedOpenSslEngine.java index 3822e0db..c160d14e 100644 --- a/test/integration/samples/ReferenceCountedOpenSslEngine.java +++ b/test/integration/samples/ReferenceCountedOpenSslEngine.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2016 The Netty Project * diff --git a/test/integration/samples/ReferenceCountedOpenSslServerContext.java b/test/integration/samples/ReferenceCountedOpenSslServerContext.java index 6d78e6d0..1979d2ab 100644 --- a/test/integration/samples/ReferenceCountedOpenSslServerContext.java +++ b/test/integration/samples/ReferenceCountedOpenSslServerContext.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2016 The Netty Project * diff --git a/test/integration/samples/RefreshListeners.java b/test/integration/samples/RefreshListeners.java index d343f863..bb4f09ee 100644 --- a/test/integration/samples/RefreshListeners.java +++ b/test/integration/samples/RefreshListeners.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with diff --git a/test/integration/samples/RequestResponseLinkCache.java b/test/integration/samples/RequestResponseLinkCache.java index caa51d77..9f40000b 100644 --- a/test/integration/samples/RequestResponseLinkCache.java +++ b/test/integration/samples/RequestResponseLinkCache.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. diff --git a/test/integration/samples/ResourceHeader.java b/test/integration/samples/ResourceHeader.java index 329a6ce0..8a0eb7ae 100644 --- a/test/integration/samples/ResourceHeader.java +++ b/test/integration/samples/ResourceHeader.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * REVIEWED: YES diff --git a/test/integration/samples/ResourceMap.java b/test/integration/samples/ResourceMap.java index afbffa40..85f5ca8a 100644 --- a/test/integration/samples/ResourceMap.java +++ b/test/integration/samples/ResourceMap.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * REVIEWED: YES diff --git a/test/integration/samples/ResultSetViewer.java b/test/integration/samples/ResultSetViewer.java index da8d7d77..d70629fa 100644 --- a/test/integration/samples/ResultSetViewer.java +++ b/test/integration/samples/ResultSetViewer.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others diff --git a/test/integration/samples/ScannerUtils.java b/test/integration/samples/ScannerUtils.java index 267cdf1a..1eaaeb47 100644 --- a/test/integration/samples/ScannerUtils.java +++ b/test/integration/samples/ScannerUtils.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SchedulerManager.java b/test/integration/samples/SchedulerManager.java index 2e25f0f3..1c9c5913 100644 --- a/test/integration/samples/SchedulerManager.java +++ b/test/integration/samples/SchedulerManager.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SequenceFile.java b/test/integration/samples/SequenceFile.java index fec0a4ac..5c953428 100644 --- a/test/integration/samples/SequenceFile.java +++ b/test/integration/samples/SequenceFile.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ServiceScheduler.java b/test/integration/samples/ServiceScheduler.java index 458a7a1c..b6e4af95 100644 --- a/test/integration/samples/ServiceScheduler.java +++ b/test/integration/samples/ServiceScheduler.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SizeCalculatingEntryWriter.java b/test/integration/samples/SizeCalculatingEntryWriter.java index b46e0651..48fae96e 100644 --- a/test/integration/samples/SizeCalculatingEntryWriter.java +++ b/test/integration/samples/SizeCalculatingEntryWriter.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright 2012-2020 the original author or authors. * diff --git a/test/integration/samples/SpecificationVersion.java b/test/integration/samples/SpecificationVersion.java index a074a6e3..3d7b2b59 100644 --- a/test/integration/samples/SpecificationVersion.java +++ b/test/integration/samples/SpecificationVersion.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SpellcheckerOptionsPanel.java b/test/integration/samples/SpellcheckerOptionsPanel.java index f744a128..47fc76f5 100644 --- a/test/integration/samples/SpellcheckerOptionsPanel.java +++ b/test/integration/samples/SpellcheckerOptionsPanel.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SpillRecord.java b/test/integration/samples/SpillRecord.java index 9e04e6fb..98b4dddd 100644 --- a/test/integration/samples/SpillRecord.java +++ b/test/integration/samples/SpillRecord.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/SqlQueryManager.java b/test/integration/samples/SqlQueryManager.java index 33e311de..5854db7a 100644 --- a/test/integration/samples/SqlQueryManager.java +++ b/test/integration/samples/SqlQueryManager.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/integration/samples/SquareRootDecomposition.java b/test/integration/samples/SquareRootDecomposition.java index 1e325c85..1f2810e2 100644 --- a/test/integration/samples/SquareRootDecomposition.java +++ b/test/integration/samples/SquareRootDecomposition.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Range queries in O(sqrt(n)) and point updates in O(1). Currently this implementation supports * summing over the entries in the array, but it can be modified to support many different diff --git a/test/integration/samples/StringDataItem.java b/test/integration/samples/StringDataItem.java index 68905a59..8fe480e8 100644 --- a/test/integration/samples/StringDataItem.java +++ b/test/integration/samples/StringDataItem.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/SvnConfigFiles.java b/test/integration/samples/SvnConfigFiles.java index bdcbbb48..6e85d663 100644 --- a/test/integration/samples/SvnConfigFiles.java +++ b/test/integration/samples/SvnConfigFiles.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/TFile.java b/test/integration/samples/TFile.java index 09cd2825..4e759d59 100644 --- a/test/integration/samples/TFile.java +++ b/test/integration/samples/TFile.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with this diff --git a/test/integration/samples/TabLayout.java b/test/integration/samples/TabLayout.java index 7d7f68cd..5a371db0 100644 --- a/test/integration/samples/TabLayout.java +++ b/test/integration/samples/TabLayout.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright (C) 2015 The Android Open Source Project * diff --git a/test/integration/samples/Table.java b/test/integration/samples/Table.java index 2c125cd2..0b614b31 100644 --- a/test/integration/samples/Table.java +++ b/test/integration/samples/Table.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * diff --git a/test/integration/samples/TableModelEditor.java b/test/integration/samples/TableModelEditor.java index 07ce7005..6e5cbcae 100644 --- a/test/integration/samples/TableModelEditor.java +++ b/test/integration/samples/TableModelEditor.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/TarjanAdjacencyMatrix.java b/test/integration/samples/TarjanAdjacencyMatrix.java index a053ec2c..2c78456f 100644 --- a/test/integration/samples/TarjanAdjacencyMatrix.java +++ b/test/integration/samples/TarjanAdjacencyMatrix.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /** * An implementation of Tarjan's SCC algorithm for a directed graph. Time Complexity: O(V^2) * diff --git a/test/integration/samples/TaskInfoFetcher.java b/test/integration/samples/TaskInfoFetcher.java index e2312fe4..bab0bba1 100644 --- a/test/integration/samples/TaskInfoFetcher.java +++ b/test/integration/samples/TaskInfoFetcher.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/integration/samples/TextSync.java b/test/integration/samples/TextSync.java index 35b911d0..1995f6fe 100644 --- a/test/integration/samples/TextSync.java +++ b/test/integration/samples/TextSync.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/TextSyncGroup.java b/test/integration/samples/TextSyncGroup.java index 37d95b88..3b7fe64a 100644 --- a/test/integration/samples/TextSyncGroup.java +++ b/test/integration/samples/TextSyncGroup.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ThreadData.java b/test/integration/samples/ThreadData.java index 6ab68b51..14beda17 100644 --- a/test/integration/samples/ThreadData.java +++ b/test/integration/samples/ThreadData.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/ToolWizardPageLog.java b/test/integration/samples/ToolWizardPageLog.java index ccff801b..e354c882 100644 --- a/test/integration/samples/ToolWizardPageLog.java +++ b/test/integration/samples/ToolWizardPageLog.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others diff --git a/test/integration/samples/TreeGraphLayout.java b/test/integration/samples/TreeGraphLayout.java index 7015b514..d7f3ff8e 100644 --- a/test/integration/samples/TreeGraphLayout.java +++ b/test/integration/samples/TreeGraphLayout.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/TrieDictionary.java b/test/integration/samples/TrieDictionary.java index c01e00ce..2fd5bf82 100644 --- a/test/integration/samples/TrieDictionary.java +++ b/test/integration/samples/TrieDictionary.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/TruffleAccess.java b/test/integration/samples/TruffleAccess.java index 386d5653..03b775a7 100644 --- a/test/integration/samples/TruffleAccess.java +++ b/test/integration/samples/TruffleAccess.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/Utils.java b/test/integration/samples/Utils.java index 90487202..18a222da 100644 --- a/test/integration/samples/Utils.java +++ b/test/integration/samples/Utils.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/VersionFileHandler.java b/test/integration/samples/VersionFileHandler.java index 571236d1..401dee60 100644 --- a/test/integration/samples/VersionFileHandler.java +++ b/test/integration/samples/VersionFileHandler.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* ### * IP: GHIDRA * REVIEWED: YES diff --git a/test/integration/samples/WatchesTreeModel.java b/test/integration/samples/WatchesTreeModel.java index bc130fd2..5ec14347 100644 --- a/test/integration/samples/WatchesTreeModel.java +++ b/test/integration/samples/WatchesTreeModel.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/WindowManagerImpl.java b/test/integration/samples/WindowManagerImpl.java index 82cecc43..4dc15827 100644 --- a/test/integration/samples/WindowManagerImpl.java +++ b/test/integration/samples/WindowManagerImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/test/integration/samples/WorkspaceDocumentManagerImpl.java b/test/integration/samples/WorkspaceDocumentManagerImpl.java index 99dd39a2..e644f71b 100644 --- a/test/integration/samples/WorkspaceDocumentManagerImpl.java +++ b/test/integration/samples/WorkspaceDocumentManagerImpl.java @@ -1,3 +1,8 @@ +// This Java code is taken from a public GitHub repository +// and is used inside Aibolit only for integration testing +// purposes. The code is never compiled or executed. + + /* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * diff --git a/test/metrics/cognitiveC/1.java b/test/metrics/cognitiveC/1.java index 3b34c27e..eca793c2 100644 --- a/test/metrics/cognitiveC/1.java +++ b/test/metrics/cognitiveC/1.java @@ -8,17 +8,17 @@ public static List readDataGet(String file) throws FileNotFoundExcepti Scanner scanner = null; try { scanner = new Scanner(new File(file)); - while(scanner.hasNextLine()) { + while(scanner.hasNextLine()) { // +1 String line = scanner.nextLine(); - if (line.startsWith("#")) { - continue; + if (line.startsWith("#")) { // +1 +1 + continue; // +1 } String[] columns = line.split("\\s+"); // skip first column and last column is the label int i = 1; int[] data = new int[columns.length-2]; - for (i=1; i readDataGet(String file) throws FileNotFoundExcepti dataset.add(instance); } } finally { - if (scanner != null) + if (scanner != null) // +1 scanner.close(); } return dataset; - } - -} \ No newline at end of file + } +} diff --git a/test/metrics/cognitiveC/2.java b/test/metrics/cognitiveC/2.java index 2eb72c5e..b4b7fb8e 100644 --- a/test/metrics/cognitiveC/2.java +++ b/test/metrics/cognitiveC/2.java @@ -3,21 +3,21 @@ class T1 { public static void main(String[] arg) { int a = 1; - if (time < 2) { + if (time < 2) { // +1 a = 1; - if (time < 3) { + if (time < 3) { // +1 +1 a = 2; - } else if (a) { + } else if (a) { // +1 a = 3; - } else { + } else { // +1 a = 4; } - } else if (a) { - if (time > 111) { + } else if (a) { // +1 + if (time > 111) { // +1 +1 a = 5; } - } else { + } else { // +1 return 5; } } diff --git a/test/metrics/cognitiveC/3.java b/test/metrics/cognitiveC/3.java index 9312a5ec..e6ab716c 100644 --- a/test/metrics/cognitiveC/3.java +++ b/test/metrics/cognitiveC/3.java @@ -1,34 +1,34 @@ - public class Parser implements ParserConstants { +public class Parser implements ParserConstants { - final public void ntDefinitions() throws ParseException { - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case IDENTIFIER: - case 7: - case 12: - case 15: - case 16: - case 17: - case 18: - case 20: - case 38: - ; - break; - default: - jj_la1[0] = jj_gen; - break label_1; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 38: - ntExtendedAttributeListNonEmpty(); - break; - default: - jj_la1[1] = jj_gen; - ; - } - ntDefinition(); + final public void ntDefinitions() throws ParseException { + label_1: + while (true) { // +1 + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { // +1 +1 +1 + case IDENTIFIER: + case 7: + case 12: + case 15: + case 16: + case 17: + case 18: + case 20: + case 38: + ; + break; // +1 + default: + jj_la1[0] = jj_gen; + break label_1; // +1 } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { // +1 +1 +1 + case 38: + ntExtendedAttributeListNonEmpty(); + break; // +1 + default: + jj_la1[1] = jj_gen; + ; + } + ntDefinition(); } - - } \ No newline at end of file + } + + } \ No newline at end of file diff --git a/test/metrics/cognitiveC/4.java b/test/metrics/cognitiveC/4.java index 9250248d..2ff335f4 100644 --- a/test/metrics/cognitiveC/4.java +++ b/test/metrics/cognitiveC/4.java @@ -1,16 +1,16 @@ class Test { public static void main(String[] arg) { int a = 1; - if ( a && b && c || d || e && f) { + if ( a && b && c || d || e && f) { // +1 +3 a = 1; } } - + public static void main(String[] arg) { int a = 1; - if ( a && !(b && c)) { + if ( a && !(b && c)) { // +1 +1 a = 1; } } -} \ No newline at end of file +} diff --git a/test/metrics/cognitiveC/5.java b/test/metrics/cognitiveC/5.java index 3de7f110..be2eadc5 100644 --- a/test/metrics/cognitiveC/5.java +++ b/test/metrics/cognitiveC/5.java @@ -1,7 +1,7 @@ class Test { public static void main(String[] arg) { int a = 1; - if ( b && c ^ a && p || 2 || 3 | 5) { + if ( b && c ^ a && p || 2 || 3 | 5) { // +1 +2 a = 1 ^ 5; } } diff --git a/test/metrics/cognitiveC/6.java b/test/metrics/cognitiveC/6.java index 4de38648..a4168db4 100644 --- a/test/metrics/cognitiveC/6.java +++ b/test/metrics/cognitiveC/6.java @@ -3,17 +3,17 @@ public static void bar() { boolean a, b = true; int j = 0; - switch (j) { + switch (j) { // +1 case 0: case 1: - case 3: if (a || b) {} break; + case 3: if (a || b) {} break; // +2 +1 +1 } - switch (j) { + switch (j) { // +1 case 0: case 1: - case 3: if (a || b) {} break; + case 3: if (a || b) {} break; // +2 +1 +1 } - if (true || a && b); - while (j++ < 20); + if (true || a && b); // +1 +2 + while (j++ < 20); // +1 } } \ No newline at end of file diff --git a/test/metrics/cognitiveC/7.java b/test/metrics/cognitiveC/7.java index d0851482..cbef9746 100644 --- a/test/metrics/cognitiveC/7.java +++ b/test/metrics/cognitiveC/7.java @@ -3,29 +3,29 @@ class T1 { public static void main(String[] arg) { int a = 1; - if (time < 2) { + if (time < 2) { // +1 a = 1; - if (time < 3) { + if (time < 3) { // +1 +1 a = 2; - } else if (a) { + } else if (a) { // +1 a = 3; - } else { + } else { // +1 a = 4; } - } else if (a) { - if (time > 111) { - if (time < 150) { + } else if (a) { // +1 + if (time > 111) { // +1 +1 + if (time < 150) { // +1 +2 binary_search(1); - if (time != 140) { + if (time = 140) { // +1 +3 a = 1; - }else { + }else { // +1 a = 3; } } a = 5; } - } else { + } else { // +1 return 5; } } diff --git a/test/metrics/cognitiveC/8.java b/test/metrics/cognitiveC/8.java index 07e3c04c..6c1c1c5a 100644 --- a/test/metrics/cognitiveC/8.java +++ b/test/metrics/cognitiveC/8.java @@ -3,29 +3,29 @@ class T1 { public static void main(String[] arg) { int a = 1; - if (time < 2) { + if (time < 2) { // +1 a = 1; - if (time < 3) { + if (time < 3) { // +2 a = 2; - } else if (a) { + } else if (a) { // +1 a = 3; - } else { + } else { // +1 a = 4; } - } else if (a) { - if (time > 111) { + } else if (a) { // +1 + if (time > 111) { // +2 a = 5; } - } else { + } else { // +1 return 5; } } public static void main(String[] arg) { int a = 1; - if (time < 2) { + if (time < 2) { // +1 a = 1; - } else { - if (1 > 2) { + } else { // +1 + if (1 > 2) { // +2 time = 2; } diff --git a/test/metrics/cognitiveC/recursion.java b/test/metrics/cognitiveC/recursion.java index 92cf7acd..a604d0e9 100644 --- a/test/metrics/cognitiveC/recursion.java +++ b/test/metrics/cognitiveC/recursion.java @@ -4,30 +4,30 @@ public int compare(String firstStr, String secondStr) { } public void recursionFucn() { System.out.println("Miss me?!"); - recursionFucn(); + recursionFucn(); // +1 } int fact(int n) { // wrong base case (it may cause // stack overflow). - if (n == 100) + if (n == 100) // +1 return 1; - else - return n*fact(n-1); + else // +1 + return n*fact(n-1); // +1 } static void printFun(int test) { - if (test < 1) + if (test < 1) // +1 return; - else { + else { // +1 System.out.printf("%d ", test); // Statement 2 - printFun(test - 1); + printFun(test - 1); // +1 System.out.printf("%d ", test); return; diff --git a/test/metrics/cognitiveC/test_cognitive_c.py b/test/metrics/cognitiveC/test_cognitive_c.py index bc52643c..b6772b7d 100644 --- a/test/metrics/cognitiveC/test_cognitive_c.py +++ b/test/metrics/cognitiveC/test_cognitive_c.py @@ -48,7 +48,7 @@ def test4(self): def test5(self): lines = self.get_cc.value(Path(self.dir_path, '5.java')) - self.assertEqual(lines, 7) + self.assertEqual(lines, 3) def test6(self): lines = self.get_cc.value(Path(self.dir_path, '6.java')) @@ -56,7 +56,7 @@ def test6(self): def test7(self): lines = self.get_cc.value(Path(self.dir_path, 'recursion.java')) - self.assertEqual(lines, 7) + self.assertEqual(lines, 6) def test8(self): lines = self.get_cc.value(Path(self.dir_path, 'nested.java')) diff --git a/test/patterns/if_return_if_detection/5.java b/test/patterns/if_return_if_detection/5.java index ceb8b03d..a17bae48 100644 --- a/test/patterns/if_return_if_detection/5.java +++ b/test/patterns/if_return_if_detection/5.java @@ -21,4 +21,4 @@ public static void main(String[] arg) { return 2; } } -} \ No newline at end of file +} diff --git a/test/patterns/if_return_if_detection/test_if_return_if.py b/test/patterns/if_return_if_detection/test_if_return_if.py index 9e4675b2..31cbe348 100644 --- a/test/patterns/if_return_if_detection/test_if_return_if.py +++ b/test/patterns/if_return_if_detection/test_if_return_if.py @@ -30,14 +30,14 @@ class TestCountIfReturn(TestCase): dir_path = Path(os.path.realpath(__file__)).parent countifreturn = CountIfReturn() - def test_no_return_inside(self): - lines = self.countifreturn.value(Path(self.dir_path, '2.java')) - self.assertEqual(lines, []) - def test_2nd_level_inside(self): lines = self.countifreturn.value(Path(self.dir_path, '1.java')) self.assertEqual(lines, [6, 10]) + def test_no_return_inside(self): + lines = self.countifreturn.value(Path(self.dir_path, '2.java')) + self.assertEqual(lines, []) + def test_nested_one_goodreturn(self): lines = self.countifreturn.value(Path(self.dir_path, '3.java')) self.assertEqual(lines, []) diff --git a/test/recommend/annotations/ClassAnnotations.java b/test/recommend/annotations/ClassAnnotations.java new file mode 100644 index 00000000..e35416b4 --- /dev/null +++ b/test/recommend/annotations/ClassAnnotations.java @@ -0,0 +1,61 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings("aibolit.P11") +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + private XMLStreamReader2 getStreamReader(Resource wrapper, boolean quiet) + throws XMLStreamException, IOException { + Object resource = wrapper.getResource(); + boolean isRestricted = wrapper.isParserRestricted(); + XMLStreamReader2 reader = null; + if (resource instanceof URL) { // an URL resource + reader = (XMLStreamReader2)parse((URL)resource, isRestricted); + } else if (resource instanceof String) { // a CLASSPATH resource + URL url = getResource((String)resource); + reader = (XMLStreamReader2)parse(url, isRestricted); + } else if (resource instanceof Path) { // a file resource + // Can't use FileSystem API or we get an infinite loop + // since FileSystem uses Configuration API. Use java.io.File instead. + File file = new File(((Path)resource).toUri().getPath()) + .getAbsoluteFile(); + if (file.exists()) { + if (!quiet) { + LOG.debug("parsing File " + file); + } + reader = (XMLStreamReader2)parse(new BufferedInputStream( + Files.newInputStream(file.toPath())), ((Path) resource).toString(), + isRestricted); + } + } else if (resource instanceof InputStream) { + reader = (XMLStreamReader2)parse((InputStream)resource, null, + isRestricted); + } + return reader; + } +} diff --git a/test/recommend/annotations/MutipleAnnotations.java b/test/recommend/annotations/MutipleAnnotations.java new file mode 100644 index 00000000..da65a5f2 --- /dev/null +++ b/test/recommend/annotations/MutipleAnnotations.java @@ -0,0 +1,66 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P23") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @Nullable private Bitmap bitmap; + + @SuppressWarnings("aibolit.P23") + public void set() { + this.dirName = "level"; + } + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private XMLStreamReader2 getStreamReader(Resource wrapper, boolean quiet) + throws XMLStreamException, IOException { + Object resource = wrapper.getResource(); + boolean isRestricted = wrapper.isParserRestricted(); + XMLStreamReader2 reader = null; + if (resource instanceof URL) { // an URL resource + reader = (XMLStreamReader2)parse((URL)resource, isRestricted); + } else if (resource instanceof String) { // a CLASSPATH resource + URL url = getResource((String)resource); + reader = (XMLStreamReader2)parse(url, isRestricted); + } else if (resource instanceof Path) { // a file resource + // Can't use FileSystem API or we get an infinite loop + // since FileSystem uses Configuration API. Use java.io.File instead. + File file = new File(((Path)resource).toUri().getPath()) + .getAbsoluteFile(); + if (file.exists()) { + if (!quiet) { + LOG.debug("parsing File " + file); + } + reader = (XMLStreamReader2)parse(new BufferedInputStream( + Files.newInputStream(file.toPath())), ((Path) resource).toString(), + isRestricted); + } + } else if (resource instanceof InputStream) { + reader = (XMLStreamReader2)parse((InputStream)resource, null, + isRestricted); + } + return reader; + } +} diff --git a/test/recommend/start_end/AnonymousClass.java b/test/recommend/start_end/AnonymousClass.java new file mode 100644 index 00000000..97fa7b90 --- /dev/null +++ b/test/recommend/start_end/AnonymousClass.java @@ -0,0 +1,43 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + public int getWidth() { + int a = 0; + List actions = new ArrayList(); + actions.add(new Runnable() { + @Override + public void run() { + int b = 0; + } + }); + return width; + } +} diff --git a/test/recommend/start_end/EmptyFunction.java b/test/recommend/start_end/EmptyFunction.java new file mode 100644 index 00000000..81d748d1 --- /dev/null +++ b/test/recommend/start_end/EmptyFunction.java @@ -0,0 +1,34 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + public int getWidth() { + } +} diff --git a/test/recommend/start_end/Lambda.java b/test/recommend/start_end/Lambda.java new file mode 100644 index 00000000..1ce5e716 --- /dev/null +++ b/test/recommend/start_end/Lambda.java @@ -0,0 +1,45 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + public ArrayList filterWithOptionalEmpty(Long threshold) { + Function filter = last -> { + final Optional size; + if (last >= threshold) { + size = Optional.empty(); + } else { + size = Optional.of(last); + } + return size; + }; + + return array.map(filter); + } +} diff --git a/test/recommend/start_end/LottieImageAsset.java b/test/recommend/start_end/LottieImageAsset.java new file mode 100644 index 00000000..c33256db --- /dev/null +++ b/test/recommend/start_end/LottieImageAsset.java @@ -0,0 +1,61 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + private XMLStreamReader2 getStreamReader(Resource wrapper, boolean quiet) + throws XMLStreamException, IOException { + Object resource = wrapper.getResource(); + boolean isRestricted = wrapper.isParserRestricted(); + XMLStreamReader2 reader = null; + if (resource instanceof URL) { // an URL resource + reader = (XMLStreamReader2)parse((URL)resource, isRestricted); + } else if (resource instanceof String) { // a CLASSPATH resource + URL url = getResource((String)resource); + reader = (XMLStreamReader2)parse(url, isRestricted); + } else if (resource instanceof Path) { // a file resource + // Can't use FileSystem API or we get an infinite loop + // since FileSystem uses Configuration API. Use java.io.File instead. + File file = new File(((Path)resource).toUri().getPath()) + .getAbsoluteFile(); + if (file.exists()) { + if (!quiet) { + LOG.debug("parsing File " + file); + } + reader = (XMLStreamReader2)parse(new BufferedInputStream( + Files.newInputStream(file.toPath())), ((Path) resource).toString(), + isRestricted); + } + } else if (resource instanceof InputStream) { + reader = (XMLStreamReader2)parse((InputStream)resource, null, + isRestricted); + } + return reader; + } +} diff --git a/test/recommend/start_end/OneLineFunction.java b/test/recommend/start_end/OneLineFunction.java new file mode 100644 index 00000000..e4dfb879 --- /dev/null +++ b/test/recommend/start_end/OneLineFunction.java @@ -0,0 +1,33 @@ +package com.airbnb.lottie; + +import android.graphics.Bitmap; +import androidx.annotation.Nullable; +import androidx.annotation.RestrictTo; + +/** + * Data class describing an image asset exported by bodymovin. + */ +@SuppressWarnings({"aibolit.P23", "aibolit.P11"}) +public class LottieImageAsset { + private final int width; + private final int height; + private final String id; + @SuppressWarnings("aibolit.P27") + private final String fileName; + @SuppressWarnings({"aibolit.P23", "aibolit.P22"}) + private final String dirName; + /** Pre-set a bitmap for this asset */ + @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) + @Nullable private Bitmap bitmap; + + @RestrictTo(RestrictTo.Scope.LIBRARY) + public LottieImageAsset(int width, int height, String id, String fileName, String dirName) { + this.width = width; + this.height = height; + this.id = id; + this.fileName = fileName; + this.dirName = dirName; + } + + public int getWidth() { int a = 0; int b = 0;} +} diff --git a/test/recommend/test_recommend_pipeline.py b/test/recommend/test_recommend_pipeline.py index 1b455d8b..f1ba8dec 100644 --- a/test/recommend/test_recommend_pipeline.py +++ b/test/recommend/test_recommend_pipeline.py @@ -25,10 +25,13 @@ from pathlib import Path from unittest import TestCase +import javalang + from aibolit.config import Config from aibolit.__main__ import list_dir, calculate_patterns_and_metrics, \ - create_xml_tree, create_text, format_converter_for_pattern + create_xml_tree, create_text, format_converter_for_pattern, find_start_and_end_lines, \ + find_annotation_by_node_type, add_pattern_if_ignored class TestRecommendPipeline(TestCase): @@ -186,3 +189,122 @@ def test_text_format_sort_by_code_line(self): text = create_text(new_mock, full_report=True) md5_hash = md5('\n'.join(text).encode('utf-8')) self.assertEqual(md5_hash.hexdigest(), '1324e129e6badbfb6e10f742667023ae') + + def test_find_start_end_line_function(self): + # Check start and end line for MethodDeclaration, + # find_start_and_end_lines is used for functions only at the moment + file = Path(self.cur_file_dir, 'start_end/LottieImageAsset.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 32) + self.assertEqual(end, 59) + + def test_find_start_end_line_empty_function(self): + # Check start and end line for MethodDeclaration, + # find_start_and_end_lines is used for functions only at the moment + file = Path(self.cur_file_dir, 'start_end/EmptyFunction.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 32) + self.assertEqual(end, 32) + + def test_find_start_end_line_empty_function_with_one_line(self): + file = Path(self.cur_file_dir, 'start_end/OneLineFunction.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 32) + self.assertEqual(end, 32) + + def test_find_start_end_line_empty_function_with_lambda(self): + file = Path(self.cur_file_dir, 'start_end/Lambda.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 32) + self.assertEqual(end, 43) + + def test_find_start_end_line_empty_function_with_anonymous_class(self): + file = Path(self.cur_file_dir, 'start_end/AnonymousClass.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 32) + self.assertEqual(end, 41) + + def test_find_start_end_line_empty_function_in_anonymous_class(self): + file = Path(self.cur_file_dir, 'start_end/AnonymousClass.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.MethodDeclaration))[1][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 37) + self.assertEqual(end, 38) + + def test_find_start_end_line_in_class(self): + file = Path(self.cur_file_dir, 'start_end/LottieImageAsset.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + method = list(tree.filter(javalang.tree.ClassDeclaration))[0][1] + start, end = find_start_and_end_lines(method) + self.assertEqual(start, 11) + self.assertEqual(end, 59) + + def test_find_annotation_by_class_declaration(self): + file = Path(self.cur_file_dir, 'annotations/ClassAnnotations.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + classes_with_annonations = find_annotation_by_node_type(tree, javalang.tree.ClassDeclaration) + pattern_found = list(classes_with_annonations.values())[0][0] + self.assertEqual(pattern_found, 'P11') + + def test_find_mutiple_annotations_by_class_declaration(self): + file = Path(self.cur_file_dir, 'annotations/MutipleAnnotations.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + classes_with_annonations = find_annotation_by_node_type(tree, javalang.tree.ClassDeclaration) + patterns_found = list(classes_with_annonations.values())[0] + self.assertEqual(patterns_found, ['P23', 'P11']) + + def test_find_annotation_method_declaration(self): + file = Path(self.cur_file_dir, 'annotations/MutipleAnnotations.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + functions_with_annotations = find_annotation_by_node_type(tree, javalang.tree.MethodDeclaration) + patterns_found_with_functions = [(x.name, y) for x, y in functions_with_annotations.items()] + self.assertEqual(patterns_found_with_functions, [('set', ['P23']), ('getStreamReader', ['P23', 'P22'])]) + + def test_find_annotation_by_field_declaration(self): + file = Path(self.cur_file_dir, 'annotations/MutipleAnnotations.java') + with open(file, 'r', encoding='utf-8') as f: + tree = javalang.parse.parse(f.read()) + fields_with_annotations = find_annotation_by_node_type(tree, javalang.tree.FieldDeclaration) + patterns_found_with_fields = list(fields_with_annotations.values()) + self.assertEqual(patterns_found_with_fields, [['P23'], ['P23', 'P22']]) + + def test_pattern_ignore(self): + pattern_item = {'code_lines': [20], + 'pattern_code': 'P13', + 'pattern_name': 'Null check', + 'importance': 30.95612931128819} + results = [] + pattern_ignored = {'P13': [[10, 20]]} + add_pattern_if_ignored(pattern_ignored, pattern_item, results) + self.assertEqual(results, []) + + def test_pattern_not_ignore(self): + pattern_item = {'code_lines': [20, 30], + 'pattern_code': 'P14', + 'pattern_name': 'Null check', + 'importance': 30.95612931128819} + results = [] + pattern_ignored = {'P14': [[60, 100]]} + add_pattern_if_ignored(pattern_ignored, pattern_item, results) + self.assertEqual(results[0]['code_lines'], pattern_item['code_lines'])