diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/CommentBlock.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/CommentBlock.cs index 6d4a2cf07f9..a564d3e7f16 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/CommentBlock.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/CommentBlock.cs @@ -42,7 +42,5 @@ namespace Semmle.Extraction.CSharp.Entities public override CommentBlock Create(Context cx, Comments.CommentBlock init) => new CommentBlock(cx, init); } - - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Compilation.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Compilation.cs index f3672e4c6e4..75614d3ad1e 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Compilation.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Compilation.cs @@ -87,8 +87,6 @@ namespace Semmle.Extraction.CSharp.Entities trapFile.Write(";compilation"); } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - public override Location ReportingLocation => throw new NotImplementedException(); public override bool NeedsPopulation => Context.IsAssemblyScope; diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Diagnostic.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Diagnostic.cs index def6edbf5ad..a53ee5797f2 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Diagnostic.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilations/Diagnostic.cs @@ -4,8 +4,6 @@ namespace Semmle.Extraction.CSharp.Entities { internal class Diagnostic : FreshEntity { - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - private readonly Microsoft.CodeAnalysis.Diagnostic diagnostic; public Diagnostic(Context cx, Microsoft.CodeAnalysis.Diagnostic diag) : base(cx) diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Event.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Event.cs index ca9753d229b..e88d886efec 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Event.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Event.cs @@ -71,7 +71,5 @@ namespace Semmle.Extraction.CSharp.Entities public override Event Create(Context cx, IEventSymbol init) => new Event(cx, init); } - - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Namespace.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Namespace.cs index 68b108743f3..874d8e1b69f 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Namespace.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Namespace.cs @@ -43,8 +43,6 @@ namespace Semmle.Extraction.CSharp.Entities public override Namespace Create(Context cx, INamespaceSymbol init) => new Namespace(cx, init); } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - public override int GetHashCode() => QualifiedName.GetHashCode(); private string QualifiedName => Symbol.ToDisplayString(); diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs index b9fd57b2cea..bb5a55e19db 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs @@ -60,8 +60,6 @@ namespace Semmle.Extraction.CSharp.Entities new NamespaceDeclaration(cx, init.decl, init.parent); } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - public override Microsoft.CodeAnalysis.Location ReportingLocation => node.Name.GetLocation(); public override bool NeedsPopulation => true; diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/DefineDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/DefineDirective.cs index 2ca967a4864..a11b9d94ab5 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/DefineDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/DefineDirective.cs @@ -5,14 +5,24 @@ namespace Semmle.Extraction.CSharp.Entities { internal class DefineDirective : PreprocessorDirective { - public DefineDirective(Context cx, DefineDirectiveTriviaSyntax trivia) + private DefineDirective(Context cx, DefineDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_defines(this, trivia.Name.ToString()); + trapFile.directive_defines(this, Symbol.Name.ToString()); + } + + public static DefineDirective Create(Context cx, DefineDirectiveTriviaSyntax def) => + DefineDirectiveFactory.Instance.CreateEntity(cx, def, def); + + private class DefineDirectiveFactory : CachedEntityFactory + { + public static DefineDirectiveFactory Instance { get; } = new DefineDirectiveFactory(); + + public override DefineDirective Create(Context cx, DefineDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElifDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElifDirective.cs index ece87fd1f42..9d39bf6461b 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElifDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElifDirective.cs @@ -8,21 +8,41 @@ namespace Semmle.Extraction.CSharp.Entities private readonly IfDirective start; private readonly int index; - public ElifDirective(Context cx, ElifDirectiveTriviaSyntax trivia, IfDirective start, int index) - : base(cx, trivia, populateFromBase: false) + private ElifDirective(Context cx, ElifDirectiveTriviaSyntax trivia, IfDirective start, int index) + : base(cx, trivia) { this.start = start; this.index = index; - TryPopulate(); } public bool IsTopLevelParent => true; + public override void WriteId(EscapingTextWriter trapFile) + { + trapFile.WriteSubId(Context.CreateLocation(ReportingLocation)); + trapFile.Write(Symbol.IsActive); + trapFile.Write(','); + trapFile.Write(Symbol.BranchTaken); + trapFile.Write(','); + trapFile.Write(Symbol.ConditionValue); + trapFile.Write(";trivia"); + } + protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_elifs(this, trivia.BranchTaken, trivia.ConditionValue, start, index); + trapFile.directive_elifs(this, Symbol.BranchTaken, Symbol.ConditionValue, start, index); - Expression.Create(Context, trivia.Condition, this, 0); + Expression.Create(Context, Symbol.Condition, this, 0); + } + + public static ElifDirective Create(Context cx, ElifDirectiveTriviaSyntax elif, IfDirective start, int index) => + ElifDirectiveFactory.Instance.CreateEntity(cx, elif, (elif, start, index)); + + private class ElifDirectiveFactory : CachedEntityFactory<(ElifDirectiveTriviaSyntax elif, IfDirective start, int index), ElifDirective> + { + public static ElifDirectiveFactory Instance { get; } = new ElifDirectiveFactory(); + + public override ElifDirective Create(Context cx, (ElifDirectiveTriviaSyntax elif, IfDirective start, int index) init) => new(cx, init.elif, init.start, init.index); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElseDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElseDirective.cs index 7ab7d45b6e9..1fddae7fbcc 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElseDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ElseDirective.cs @@ -8,17 +8,35 @@ namespace Semmle.Extraction.CSharp.Entities private readonly IfDirective start; private readonly int index; - public ElseDirective(Context cx, ElseDirectiveTriviaSyntax trivia, IfDirective start, int index) - : base(cx, trivia, populateFromBase: false) + private ElseDirective(Context cx, ElseDirectiveTriviaSyntax trivia, IfDirective start, int index) + : base(cx, trivia) { this.start = start; this.index = index; - TryPopulate(); + } + + public override void WriteId(EscapingTextWriter trapFile) + { + trapFile.WriteSubId(Context.CreateLocation(ReportingLocation)); + trapFile.Write(Symbol.IsActive); + trapFile.Write(','); + trapFile.Write(Symbol.BranchTaken); + trapFile.Write(";trivia"); } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_elses(this, trivia.BranchTaken, start, index); + trapFile.directive_elses(this, Symbol.BranchTaken, start, index); + } + + public static ElseDirective Create(Context cx, ElseDirectiveTriviaSyntax @else, IfDirective start, int index) => + ElseDirectiveFactory.Instance.CreateEntity(cx, @else, (@else, start, index)); + + private class ElseDirectiveFactory : CachedEntityFactory<(ElseDirectiveTriviaSyntax @else, IfDirective start, int index), ElseDirective> + { + public static ElseDirectiveFactory Instance { get; } = new ElseDirectiveFactory(); + + public override ElseDirective Create(Context cx, (ElseDirectiveTriviaSyntax @else, IfDirective start, int index) init) => new(cx, init.@else, init.start, init.index); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndIfDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndIfDirective.cs index 9c349844dc6..eb13b62f757 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndIfDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndIfDirective.cs @@ -7,16 +7,25 @@ namespace Semmle.Extraction.CSharp.Entities { private readonly IfDirective start; - public EndIfDirective(Context cx, EndIfDirectiveTriviaSyntax trivia, IfDirective start) - : base(cx, trivia, populateFromBase: false) + private EndIfDirective(Context cx, EndIfDirectiveTriviaSyntax trivia, IfDirective start) + : base(cx, trivia) { this.start = start; - TryPopulate(); } protected override void PopulatePreprocessor(TextWriter trapFile) { trapFile.directive_endifs(this, start); } + + public static EndIfDirective Create(Context cx, EndIfDirectiveTriviaSyntax endif, IfDirective start) => + EndIfDirectiveFactory.Instance.CreateEntity(cx, endif, (endif, start)); + + private class EndIfDirectiveFactory : CachedEntityFactory<(EndIfDirectiveTriviaSyntax endif, IfDirective start), EndIfDirective> + { + public static EndIfDirectiveFactory Instance { get; } = new EndIfDirectiveFactory(); + + public override EndIfDirective Create(Context cx, (EndIfDirectiveTriviaSyntax endif, IfDirective start) init) => new(cx, init.endif, init.start); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndRegionDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndRegionDirective.cs index d4d75470a97..570f9ad61a3 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndRegionDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/EndRegionDirective.cs @@ -7,16 +7,25 @@ namespace Semmle.Extraction.CSharp.Entities { private readonly RegionDirective region; - public EndRegionDirective(Context cx, EndRegionDirectiveTriviaSyntax trivia, RegionDirective region) - : base(cx, trivia, populateFromBase: false) + private EndRegionDirective(Context cx, EndRegionDirectiveTriviaSyntax trivia, RegionDirective region) + : base(cx, trivia) { this.region = region; - TryPopulate(); } protected override void PopulatePreprocessor(TextWriter trapFile) { trapFile.directive_endregions(this, region); } + + public static EndRegionDirective Create(Context cx, EndRegionDirectiveTriviaSyntax end, RegionDirective start) => + EndRegionDirectiveFactory.Instance.CreateEntity(cx, end, (end, start)); + + private class EndRegionDirectiveFactory : CachedEntityFactory<(EndRegionDirectiveTriviaSyntax end, RegionDirective start), EndRegionDirective> + { + public static EndRegionDirectiveFactory Instance { get; } = new EndRegionDirectiveFactory(); + + public override EndRegionDirective Create(Context cx, (EndRegionDirectiveTriviaSyntax end, RegionDirective start) init) => new(cx, init.end, init.start); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ErrorDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ErrorDirective.cs index 2917d077839..b0207769bb3 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ErrorDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/ErrorDirective.cs @@ -5,14 +5,24 @@ namespace Semmle.Extraction.CSharp.Entities { internal class ErrorDirective : PreprocessorDirective { - public ErrorDirective(Context cx, ErrorDirectiveTriviaSyntax trivia) + private ErrorDirective(Context cx, ErrorDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_errors(this, trivia.EndOfDirectiveToken.LeadingTrivia.ToString()); + trapFile.directive_errors(this, Symbol.EndOfDirectiveToken.LeadingTrivia.ToString()); + } + + public static ErrorDirective Create(Context cx, ErrorDirectiveTriviaSyntax error) => + ErrorDirectiveFactory.Instance.CreateEntity(cx, error, error); + + private class ErrorDirectiveFactory : CachedEntityFactory + { + public static ErrorDirectiveFactory Instance { get; } = new ErrorDirectiveFactory(); + + public override ErrorDirective Create(Context cx, ErrorDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/IfDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/IfDirective.cs index 29c6f741620..415bba4ed5f 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/IfDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/IfDirective.cs @@ -5,18 +5,39 @@ namespace Semmle.Extraction.CSharp.Entities { internal class IfDirective : PreprocessorDirective, IExpressionParentEntity { - public IfDirective(Context cx, IfDirectiveTriviaSyntax trivia) + private IfDirective(Context cx, IfDirectiveTriviaSyntax trivia) : base(cx, trivia) { } public bool IsTopLevelParent => true; + public override void WriteId(EscapingTextWriter trapFile) + { + trapFile.WriteSubId(Context.CreateLocation(ReportingLocation)); + trapFile.Write(Symbol.IsActive); + trapFile.Write(','); + trapFile.Write(Symbol.BranchTaken); + trapFile.Write(','); + trapFile.Write(Symbol.ConditionValue); + trapFile.Write(";trivia"); + } + protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_ifs(this, trivia.BranchTaken, trivia.ConditionValue); + trapFile.directive_ifs(this, Symbol.BranchTaken, Symbol.ConditionValue); - Expression.Create(Context, trivia.Condition, this, 0); + Expression.Create(Context, Symbol.Condition, this, 0); + } + + public static IfDirective Create(Context cx, IfDirectiveTriviaSyntax @if) => + IfDirectiveFactory.Instance.CreateEntity(cx, @if, @if); + + private class IfDirectiveFactory : CachedEntityFactory + { + public static IfDirectiveFactory Instance { get; } = new IfDirectiveFactory(); + + public override IfDirective Create(Context cx, IfDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/LineDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/LineDirective.cs index 06fafd1e4ce..6afae54a129 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/LineDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/LineDirective.cs @@ -7,34 +7,44 @@ namespace Semmle.Extraction.CSharp.Entities { internal class LineDirective : PreprocessorDirective { - public LineDirective(Context cx, LineDirectiveTriviaSyntax trivia) + private LineDirective(Context cx, LineDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - var type = trivia.Line.Kind() switch + var type = Symbol.Line.Kind() switch { SyntaxKind.DefaultKeyword => 0, SyntaxKind.HiddenKeyword => 1, SyntaxKind.NumericLiteralToken => 2, - _ => throw new InternalError(trivia, "Unhandled line token kind") + _ => throw new InternalError(Symbol, "Unhandled line token kind") }; trapFile.directive_lines(this, type); - if (trivia.Line.IsKind(SyntaxKind.NumericLiteralToken)) + if (Symbol.Line.IsKind(SyntaxKind.NumericLiteralToken)) { - var value = (int)trivia.Line.Value!; + var value = (int)Symbol.Line.Value!; trapFile.directive_line_value(this, value); - if (!string.IsNullOrWhiteSpace(trivia.File.ValueText)) + if (!string.IsNullOrWhiteSpace(Symbol.File.ValueText)) { - var file = File.Create(Context, trivia.File.ValueText); + var file = File.Create(Context, Symbol.File.ValueText); trapFile.directive_line_file(this, file); } } } + + public static LineDirective Create(Context cx, LineDirectiveTriviaSyntax line) => + LineDirectiveFactory.Instance.CreateEntity(cx, line, line); + + private class LineDirectiveFactory : CachedEntityFactory + { + public static LineDirectiveFactory Instance { get; } = new LineDirectiveFactory(); + + public override LineDirective Create(Context cx, LineDirectiveTriviaSyntax init) => new(cx, init); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/NullableDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/NullableDirective.cs index e6bb4e79fed..93372c6200d 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/NullableDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/NullableDirective.cs @@ -6,30 +6,40 @@ namespace Semmle.Extraction.CSharp.Entities { internal class NullableDirective : PreprocessorDirective { - public NullableDirective(Context cx, NullableDirectiveTriviaSyntax trivia) + private NullableDirective(Context cx, NullableDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - var setting = trivia.SettingToken.Kind() switch + var setting = Symbol.SettingToken.Kind() switch { SyntaxKind.DisableKeyword => 0, SyntaxKind.EnableKeyword => 1, SyntaxKind.RestoreKeyword => 2, - _ => throw new InternalError(trivia, "Unhandled setting token kind") + _ => throw new InternalError(Symbol, "Unhandled setting token kind") }; - var target = trivia.TargetToken.Kind() switch + var target = Symbol.TargetToken.Kind() switch { SyntaxKind.None => 0, SyntaxKind.AnnotationsKeyword => 1, SyntaxKind.WarningsKeyword => 2, - _ => throw new InternalError(trivia, "Unhandled target token kind") + _ => throw new InternalError(Symbol, "Unhandled target token kind") }; trapFile.directive_nullables(this, setting, target); } + + public static NullableDirective Create(Context cx, NullableDirectiveTriviaSyntax nullable) => + NullableDirectiveFactory.Instance.CreateEntity(cx, nullable, nullable); + + private class NullableDirectiveFactory : CachedEntityFactory + { + public static NullableDirectiveFactory Instance { get; } = new NullableDirectiveFactory(); + + public override NullableDirective Create(Context cx, NullableDirectiveTriviaSyntax init) => new(cx, init); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaChecksumDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaChecksumDirective.cs index caa77ceec33..3e06bba104d 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaChecksumDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaChecksumDirective.cs @@ -5,15 +5,25 @@ namespace Semmle.Extraction.CSharp.Entities { internal class PragmaChecksumDirective : PreprocessorDirective { - public PragmaChecksumDirective(Context cx, PragmaChecksumDirectiveTriviaSyntax trivia) + private PragmaChecksumDirective(Context cx, PragmaChecksumDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - var file = File.Create(Context, trivia.File.ValueText); - trapFile.pragma_checksums(this, file, trivia.Guid.ToString(), trivia.Bytes.ToString()); + var file = File.Create(Context, Symbol.File.ValueText); + trapFile.pragma_checksums(this, file, Symbol.Guid.ToString(), Symbol.Bytes.ToString()); + } + + public static PragmaChecksumDirective Create(Context cx, PragmaChecksumDirectiveTriviaSyntax p) => + PragmaChecksumDirectiveFactory.Instance.CreateEntity(cx, p, p); + + private class PragmaChecksumDirectiveFactory : CachedEntityFactory + { + public static PragmaChecksumDirectiveFactory Instance { get; } = new PragmaChecksumDirectiveFactory(); + + public override PragmaChecksumDirective Create(Context cx, PragmaChecksumDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaWarningDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaWarningDirective.cs index 4502fa4a87a..0e4ca37a49f 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaWarningDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PragmaWarningDirective.cs @@ -7,20 +7,30 @@ namespace Semmle.Extraction.CSharp.Entities { internal class PragmaWarningDirective : PreprocessorDirective { - public PragmaWarningDirective(Context cx, PragmaWarningDirectiveTriviaSyntax trivia) + private PragmaWarningDirective(Context cx, PragmaWarningDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.pragma_warnings(this, trivia.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword) ? 0 : 1); + trapFile.pragma_warnings(this, Symbol.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword) ? 0 : 1); var childIndex = 0; - foreach (var code in trivia.ErrorCodes) + foreach (var code in Symbol.ErrorCodes) { trapFile.pragma_warning_error_codes(this, code.ToString(), childIndex++); } } + + public static PragmaWarningDirective Create(Context cx, PragmaWarningDirectiveTriviaSyntax p) => + PragmaWarningDirectiveFactory.Instance.CreateEntity(cx, p, p); + + private class PragmaWarningDirectiveFactory : CachedEntityFactory + { + public static PragmaWarningDirectiveFactory Instance { get; } = new PragmaWarningDirectiveFactory(); + + public override PragmaWarningDirective Create(Context cx, PragmaWarningDirectiveTriviaSyntax init) => new(cx, init); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PreprocessorDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PreprocessorDirective.cs index 13e702603ab..dba00d61207 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PreprocessorDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/PreprocessorDirective.cs @@ -4,25 +4,16 @@ using System.IO; namespace Semmle.Extraction.CSharp.Entities { - internal abstract class PreprocessorDirective : FreshEntity where TDirective : DirectiveTriviaSyntax + internal abstract class PreprocessorDirective : CachedEntity where TDirective : DirectiveTriviaSyntax { - protected readonly TDirective trivia; + protected PreprocessorDirective(Context cx, TDirective trivia) + : base(cx, trivia) { } - protected PreprocessorDirective(Context cx, TDirective trivia, bool populateFromBase = true) - : base(cx) - { - this.trivia = trivia; - if (populateFromBase) - { - TryPopulate(); - } - } - - protected sealed override void Populate(TextWriter trapFile) + public sealed override void Populate(TextWriter trapFile) { PopulatePreprocessor(trapFile); - trapFile.preprocessor_directive_active(this, trivia.IsActive); + trapFile.preprocessor_directive_active(this, Symbol.IsActive); trapFile.preprocessor_directive_location(this, Context.CreateLocation(ReportingLocation)); if (!Context.Extractor.Standalone) @@ -34,8 +25,17 @@ namespace Semmle.Extraction.CSharp.Entities protected abstract void PopulatePreprocessor(TextWriter trapFile); - public sealed override Microsoft.CodeAnalysis.Location ReportingLocation => trivia.GetLocation(); + public sealed override Microsoft.CodeAnalysis.Location ReportingLocation => Symbol.GetLocation(); + + public override bool NeedsPopulation => true; public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.OptionalLabel; + + public override void WriteId(EscapingTextWriter trapFile) + { + trapFile.WriteSubId(Context.CreateLocation(ReportingLocation)); + trapFile.Write(Symbol.IsActive); + trapFile.Write(";trivia"); + } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/RegionDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/RegionDirective.cs index b2f017688a3..f8d963d6192 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/RegionDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/RegionDirective.cs @@ -6,14 +6,24 @@ namespace Semmle.Extraction.CSharp.Entities { internal class RegionDirective : PreprocessorDirective { - public RegionDirective(Context cx, RegionDirectiveTriviaSyntax trivia) + private RegionDirective(Context cx, RegionDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_regions(this, trivia.EndOfDirectiveToken.LeadingTrivia.ToString()); + trapFile.directive_regions(this, Symbol.EndOfDirectiveToken.LeadingTrivia.ToString()); + } + + public static RegionDirective Create(Context cx, RegionDirectiveTriviaSyntax region) => + RegionDirectiveFactory.Instance.CreateEntity(cx, region, region); + + private class RegionDirectiveFactory : CachedEntityFactory + { + public static RegionDirectiveFactory Instance { get; } = new RegionDirectiveFactory(); + + public override RegionDirective Create(Context cx, RegionDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/UndefineDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/UndefineDirective.cs index d4b976d50c0..3bba6699b88 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/UndefineDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/UndefineDirective.cs @@ -5,14 +5,24 @@ namespace Semmle.Extraction.CSharp.Entities { internal class UndefineDirective : PreprocessorDirective { - public UndefineDirective(Context cx, UndefDirectiveTriviaSyntax trivia) + private UndefineDirective(Context cx, UndefDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_undefines(this, trivia.Name.ToString()); + trapFile.directive_undefines(this, Symbol.Name.ToString()); + } + + public static UndefineDirective Create(Context cx, UndefDirectiveTriviaSyntax undef) => + UndefineDirectiveFactory.Instance.CreateEntity(cx, undef, undef); + + private class UndefineDirectiveFactory : CachedEntityFactory + { + public static UndefineDirectiveFactory Instance { get; } = new UndefineDirectiveFactory(); + + public override UndefineDirective Create(Context cx, UndefDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/WarningDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/WarningDirective.cs index 1511be8d28c..2f8d2e277dc 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/WarningDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/PreprocessorDirectives/WarningDirective.cs @@ -5,14 +5,24 @@ namespace Semmle.Extraction.CSharp.Entities { internal class WarningDirective : PreprocessorDirective { - public WarningDirective(Context cx, WarningDirectiveTriviaSyntax trivia) + private WarningDirective(Context cx, WarningDirectiveTriviaSyntax trivia) : base(cx, trivia) { } protected override void PopulatePreprocessor(TextWriter trapFile) { - trapFile.directive_warnings(this, trivia.EndOfDirectiveToken.LeadingTrivia.ToString()); + trapFile.directive_warnings(this, Symbol.EndOfDirectiveToken.LeadingTrivia.ToString()); + } + + public static WarningDirective Create(Context cx, WarningDirectiveTriviaSyntax warning) => + WarningDirectiveFactory.Instance.CreateEntity(cx, warning, warning); + + private class WarningDirectiveFactory : CachedEntityFactory + { + public static WarningDirectiveFactory Instance { get; } = new WarningDirectiveFactory(); + + public override WarningDirective Create(Context cx, WarningDirectiveTriviaSyntax init) => new(cx, init); } } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs index 9e4a1c79ad2..fd9d0e586fc 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Property.cs @@ -2,7 +2,6 @@ using System; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Semmle.Extraction.CSharp.Entities.Expressions; -using Semmle.Extraction.Entities; using Semmle.Extraction.Kinds; using System.IO; using System.Linq; diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs index 67936f9a913..2b865d79772 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs @@ -341,8 +341,6 @@ namespace Semmle.Extraction.CSharp.Entities } } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - public override bool Equals(object? obj) { var other = obj as Type; diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/TypeParameterConstraints.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/TypeParameterConstraints.cs index 04ab78a0f54..e71b618bc71 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/TypeParameterConstraints.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/TypeParameterConstraints.cs @@ -7,8 +7,6 @@ namespace Semmle.Extraction.CSharp.Entities public TypeParameterConstraints(Context cx) : base(cx) { } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - protected override void Populate(TextWriter trapFile) { } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Entities/UsingDirective.cs b/csharp/extractor/Semmle.Extraction.CSharp/Entities/UsingDirective.cs index d278d904253..0948e1c31bc 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Entities/UsingDirective.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Entities/UsingDirective.cs @@ -54,7 +54,5 @@ namespace Semmle.Extraction.CSharp.Entities } public sealed override Microsoft.CodeAnalysis.Location ReportingLocation => node.GetLocation(); - - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs index 3de3a68b656..907948f2408 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs @@ -212,8 +212,13 @@ namespace Semmle.Extraction.CSharp Entities.File.Create(cx, root.SyntaxTree.FilePath); var csNode = (CSharpSyntaxNode)root; + var directiveVisitor = new DirectiveVisitor(cx); + csNode.Accept(directiveVisitor); + foreach (var branch in directiveVisitor.BranchesTaken) + { + cx.TrapStackSuffix.Add(branch); + } csNode.Accept(new CompilationUnitVisitor(cx)); - csNode.Accept(new DirectiveVisitor(cx)); cx.PopulateAll(); CommentPopulator.ExtractCommentBlocks(cx, cx.CommentGenerator); cx.PopulateAll(); diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Populators/DirectiveVisitor.cs b/csharp/extractor/Semmle.Extraction.CSharp/Populators/DirectiveVisitor.cs index 0c400728554..49b1e96990a 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Populators/DirectiveVisitor.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Populators/DirectiveVisitor.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -8,6 +9,13 @@ namespace Semmle.Extraction.CSharp.Populators internal class DirectiveVisitor : CSharpSyntaxWalker { private readonly Context cx; + private readonly List branchesTaken = new(); + + /// + /// Gets a list of `#if`, `#elif`, and `#else` entities where the branch + /// is taken. + /// + public IEnumerable BranchesTaken => branchesTaken; public DirectiveVisitor(Context cx) : base(SyntaxWalkerDepth.StructuredTrivia) { @@ -16,49 +24,49 @@ namespace Semmle.Extraction.CSharp.Populators public override void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) { - new Entities.PragmaWarningDirective(cx, node); + Entities.PragmaWarningDirective.Create(cx, node); } public override void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) { - new Entities.PragmaChecksumDirective(cx, node); + Entities.PragmaChecksumDirective.Create(cx, node); } public override void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) { - new Entities.DefineDirective(cx, node); + Entities.DefineDirective.Create(cx, node); } public override void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) { - new Entities.UndefineDirective(cx, node); + Entities.UndefineDirective.Create(cx, node); } public override void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) { - new Entities.WarningDirective(cx, node); + Entities.WarningDirective.Create(cx, node); } public override void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) { - new Entities.ErrorDirective(cx, node); + Entities.ErrorDirective.Create(cx, node); } public override void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) { - new Entities.NullableDirective(cx, node); + Entities.NullableDirective.Create(cx, node); } public override void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) { - new Entities.LineDirective(cx, node); + Entities.LineDirective.Create(cx, node); } private readonly Stack regionStarts = new Stack(); public override void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) { - var region = new Entities.RegionDirective(cx, node); + var region = Entities.RegionDirective.Create(cx, node); regionStarts.Push(region); } @@ -72,7 +80,7 @@ namespace Semmle.Extraction.CSharp.Populators } var start = regionStarts.Pop(); - new Entities.EndRegionDirective(cx, node, start); + Entities.EndRegionDirective.Create(cx, node, start); } private class IfDirectiveStackElement @@ -91,8 +99,10 @@ namespace Semmle.Extraction.CSharp.Populators public override void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) { - var ifStart = new Entities.IfDirective(cx, node); + var ifStart = Entities.IfDirective.Create(cx, node); ifStarts.Push(new IfDirectiveStackElement(ifStart)); + if (node.BranchTaken) + branchesTaken.Add(ifStart); } public override void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) @@ -105,7 +115,7 @@ namespace Semmle.Extraction.CSharp.Populators } var start = ifStarts.Pop(); - new Entities.EndIfDirective(cx, node, start.Entity); + Entities.EndIfDirective.Create(cx, node, start.Entity); } public override void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) @@ -118,7 +128,9 @@ namespace Semmle.Extraction.CSharp.Populators } var start = ifStarts.Peek(); - new Entities.ElifDirective(cx, node, start.Entity, start.SiblingCount++); + var elIf = Entities.ElifDirective.Create(cx, node, start.Entity, start.SiblingCount++); + if (node.BranchTaken) + branchesTaken.Add(elIf); } public override void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) @@ -131,7 +143,9 @@ namespace Semmle.Extraction.CSharp.Populators } var start = ifStarts.Peek(); - new Entities.ElseDirective(cx, node, start.Entity, start.SiblingCount++); + var @else = Entities.ElseDirective.Create(cx, node, start.Entity, start.SiblingCount++); + if (node.BranchTaken) + branchesTaken.Add(@else); } } } diff --git a/csharp/extractor/Semmle.Extraction/Context.cs b/csharp/extractor/Semmle.Extraction/Context.cs index 410b3c6980a..abbabcdd198 100644 --- a/csharp/extractor/Semmle.Extraction/Context.cs +++ b/csharp/extractor/Semmle.Extraction/Context.cs @@ -30,6 +30,8 @@ namespace Semmle.Extraction /// public bool ShouldAddAssemblyTrapPrefix { get; } + public IList TrapStackSuffix { get; } = new List(); + private int GetNewId() => TrapWriter.IdCounter++; // A recursion guard against writing to the trap file whilst writing an id to the trap file. @@ -270,8 +272,7 @@ namespace Semmle.Extraction return; } - bool duplicationGuard; - bool deferred; + bool duplicationGuard, deferred; switch (entity.TrapStackBehaviour) { @@ -291,14 +292,24 @@ namespace Semmle.Extraction break; case TrapStackBehaviour.PushesLabel: duplicationGuard = true; - deferred = tagStack.Any(); + deferred = duplicationGuard && tagStack.Any(); break; default: throw new InternalError("Unexpected TrapStackBehaviour"); } var a = duplicationGuard && IsEntityDuplicationGuarded(entity, out var loc) - ? (Action)(() => WithDuplicationGuard(new Key(entity, loc), () => entity.Populate(TrapWriter.Writer))) + ? (() => + { + var args = new object[TrapStackSuffix.Count + 2]; + args[0] = entity; + args[1] = loc; + for (var i = 0; i < TrapStackSuffix.Count; i++) + { + args[i + 2] = TrapStackSuffix[i]; + } + WithDuplicationGuard(new Key(args), () => entity.Populate(TrapWriter.Writer)); + }) : (Action)(() => this.Try(null, optionalSymbol, () => entity.Populate(TrapWriter.Writer))); if (deferred) diff --git a/csharp/extractor/Semmle.Extraction/Entities/Base/CachedEntity`1.cs b/csharp/extractor/Semmle.Extraction/Entities/Base/CachedEntity`1.cs index 88506638e17..4ef36362733 100644 --- a/csharp/extractor/Semmle.Extraction/Entities/Base/CachedEntity`1.cs +++ b/csharp/extractor/Semmle.Extraction/Entities/Base/CachedEntity`1.cs @@ -60,7 +60,7 @@ namespace Semmle.Extraction return other?.GetType() == GetType() && Equals(other.Symbol, Symbol); } - public override TrapStackBehaviour TrapStackBehaviour { get; } + public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } /// diff --git a/csharp/extractor/Semmle.Extraction/Entities/Base/FreshEntity.cs b/csharp/extractor/Semmle.Extraction/Entities/Base/FreshEntity.cs index bdef7ac5f66..7ecdab8086e 100644 --- a/csharp/extractor/Semmle.Extraction/Entities/Base/FreshEntity.cs +++ b/csharp/extractor/Semmle.Extraction/Entities/Base/FreshEntity.cs @@ -33,6 +33,6 @@ namespace Semmle.Extraction public override Microsoft.CodeAnalysis.Location? ReportingLocation => null; - public override TrapStackBehaviour TrapStackBehaviour { get; } + public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction/Entities/ExtractionError.cs b/csharp/extractor/Semmle.Extraction/Entities/ExtractionError.cs index f7be2995923..99f17537790 100644 --- a/csharp/extractor/Semmle.Extraction/Entities/ExtractionError.cs +++ b/csharp/extractor/Semmle.Extraction/Entities/ExtractionError.cs @@ -17,7 +17,5 @@ namespace Semmle.Extraction.Entities trapFile.extractor_messages(this, msg.Severity, "C# extractor", msg.Text, msg.EntityText ?? string.Empty, msg.Location ?? Context.CreateLocation(), msg.StackTrace ?? string.Empty); } - - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction/Entities/File.cs b/csharp/extractor/Semmle.Extraction/Entities/File.cs index 11d37c99636..952302360b1 100644 --- a/csharp/extractor/Semmle.Extraction/Entities/File.cs +++ b/csharp/extractor/Semmle.Extraction/Entities/File.cs @@ -24,7 +24,5 @@ namespace Semmle.Extraction.Entities } public override Microsoft.CodeAnalysis.Location? ReportingLocation => null; - - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; } } diff --git a/csharp/extractor/Semmle.Extraction/Entities/Folder.cs b/csharp/extractor/Semmle.Extraction/Entities/Folder.cs index 07e8c805e7f..2826ab49ed1 100644 --- a/csharp/extractor/Semmle.Extraction/Entities/Folder.cs +++ b/csharp/extractor/Semmle.Extraction/Entities/Folder.cs @@ -33,8 +33,6 @@ namespace Semmle.Extraction.Entities public override Folder Create(Context cx, PathTransformer.ITransformedPath init) => new Folder(cx, init); } - public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel; - public override int GetHashCode() => Symbol.GetHashCode(); public override bool Equals(object? obj) diff --git a/csharp/ql/test/library-tests/comments/DefineDirectives.expected b/csharp/ql/test/library-tests/comments/DefineDirectives.expected index e58b3859d58..79cdc468e92 100644 --- a/csharp/ql/test/library-tests/comments/DefineDirectives.expected +++ b/csharp/ql/test/library-tests/comments/DefineDirectives.expected @@ -1 +1,2 @@ | trivia.cs:4:1:4:13 | #define ... | DEBUG | +| trivia.cs:5:1:5:14 | #define ... | DEBUG2 | diff --git a/csharp/ql/test/library-tests/comments/Directives.expected b/csharp/ql/test/library-tests/comments/Directives.expected index c6d0a12ffb6..01b418ba754 100644 --- a/csharp/ql/test/library-tests/comments/Directives.expected +++ b/csharp/ql/test/library-tests/comments/Directives.expected @@ -1,5 +1,6 @@ directives | trivia.cs:4:1:4:13 | #define ... | trivia.cs:4:1:4:13 | trivia.cs:4:1:4:13 | active | +| trivia.cs:5:1:5:14 | #define ... | trivia.cs:5:1:5:14 | trivia.cs:5:1:5:14 | active | | trivia.cs:6:1:6:12 | #undef ... | trivia.cs:6:1:6:12 | trivia.cs:6:1:6:12 | active | | trivia.cs:12:1:12:35 | #pragma warning ... | trivia.cs:12:1:12:35 | trivia.cs:12:1:12:35 | active | | trivia.cs:13:1:13:103 | #pragma checksum ... | trivia.cs:13:1:13:103 | trivia.cs:13:1:13:103 | active | @@ -29,8 +30,15 @@ directives | trivia.cs:72:1:72:43 | #warning ... | trivia.cs:72:1:72:43 | trivia.cs:72:1:72:43 | active | | trivia.cs:74:1:74:5 | #else | trivia.cs:74:1:74:5 | trivia.cs:74:1:74:5 | active | | trivia.cs:76:1:76:6 | #endif | trivia.cs:76:1:76:6 | trivia.cs:76:1:76:6 | active | +| trivia.cs:82:1:82:10 | #if ... | trivia.cs:82:1:82:10 | trivia.cs:82:1:82:10 | active | +| trivia.cs:86:1:86:6 | #endif | trivia.cs:86:1:86:6 | trivia.cs:86:1:86:6 | active | +| trivia.cs:93:1:93:10 | #if ... | trivia.cs:93:1:93:10 | trivia.cs:93:1:93:10 | active | +| trivia.cs:95:1:95:6 | #endif | trivia.cs:95:1:95:6 | trivia.cs:95:1:95:6 | active | +| trivia.cs:103:1:103:10 | #if ... | trivia.cs:103:1:103:10 | trivia.cs:103:1:103:10 | active | +| trivia.cs:105:1:105:6 | #endif | trivia.cs:105:1:105:6 | trivia.cs:105:1:105:6 | active | comp | trivia.cs:4:1:4:13 | #define ... | compilation | +| trivia.cs:5:1:5:14 | #define ... | compilation | | trivia.cs:6:1:6:12 | #undef ... | compilation | | trivia.cs:12:1:12:35 | #pragma warning ... | compilation | | trivia.cs:13:1:13:103 | #pragma checksum ... | compilation | @@ -60,3 +68,9 @@ comp | trivia.cs:72:1:72:43 | #warning ... | compilation | | trivia.cs:74:1:74:5 | #else | compilation | | trivia.cs:76:1:76:6 | #endif | compilation | +| trivia.cs:82:1:82:10 | #if ... | compilation | +| trivia.cs:86:1:86:6 | #endif | compilation | +| trivia.cs:93:1:93:10 | #if ... | compilation | +| trivia.cs:95:1:95:6 | #endif | compilation | +| trivia.cs:103:1:103:10 | #if ... | compilation | +| trivia.cs:105:1:105:6 | #endif | compilation | diff --git a/csharp/ql/test/library-tests/comments/IfDirectives.expected b/csharp/ql/test/library-tests/comments/IfDirectives.expected index 3a3a24ef798..3b7b24e388a 100644 --- a/csharp/ql/test/library-tests/comments/IfDirectives.expected +++ b/csharp/ql/test/library-tests/comments/IfDirectives.expected @@ -1,6 +1,9 @@ ifDirectives | trivia.cs:65:1:65:9 | #if ... | trivia.cs:76:1:76:6 | #endif | not taken | false | trivia.cs:65:5:65:9 | DEBUG | | trivia.cs:68:1:68:10 | #if ... | trivia.cs:70:1:70:6 | #endif | not taken | false | trivia.cs:68:5:68:10 | NESTED | +| trivia.cs:82:1:82:10 | #if ... | trivia.cs:86:1:86:6 | #endif | taken | true | trivia.cs:82:5:82:10 | DEBUG2 | +| trivia.cs:93:1:93:10 | #if ... | trivia.cs:95:1:95:6 | #endif | taken | true | trivia.cs:93:5:93:10 | DEBUG2 | +| trivia.cs:103:1:103:10 | #if ... | trivia.cs:105:1:105:6 | #endif | taken | true | trivia.cs:103:5:103:10 | DEBUG2 | siblings | trivia.cs:65:1:65:9 | #if ... | trivia.cs:71:1:71:35 | #elif ... | 0 | taken | | trivia.cs:65:1:65:9 | #if ... | trivia.cs:74:1:74:5 | #else | 1 | not taken | @@ -8,6 +11,9 @@ conditionalDirectives | trivia.cs:65:1:65:9 | #if ... | not taken | false | trivia.cs:65:5:65:9 | DEBUG | | trivia.cs:68:1:68:10 | #if ... | not taken | false | trivia.cs:68:5:68:10 | NESTED | | trivia.cs:71:1:71:35 | #elif ... | taken | true | trivia.cs:71:7:71:35 | ... \|\| ... | +| trivia.cs:82:1:82:10 | #if ... | taken | true | trivia.cs:82:5:82:10 | DEBUG2 | +| trivia.cs:93:1:93:10 | #if ... | taken | true | trivia.cs:93:5:93:10 | DEBUG2 | +| trivia.cs:103:1:103:10 | #if ... | taken | true | trivia.cs:103:5:103:10 | DEBUG2 | expressions | trivia.cs:65:5:65:9 | DEBUG | | trivia.cs:68:5:68:10 | NESTED | @@ -17,3 +23,6 @@ expressions | trivia.cs:71:20:71:23 | true | | trivia.cs:71:29:71:35 | !... | | trivia.cs:71:31:71:34 | TEST | +| trivia.cs:82:5:82:10 | DEBUG2 | +| trivia.cs:93:5:93:10 | DEBUG2 | +| trivia.cs:103:5:103:10 | DEBUG2 | diff --git a/csharp/ql/test/library-tests/comments/PrintAst.expected b/csharp/ql/test/library-tests/comments/PrintAst.expected index 71d16cdf134..3861072de89 100644 --- a/csharp/ql/test/library-tests/comments/PrintAst.expected +++ b/csharp/ql/test/library-tests/comments/PrintAst.expected @@ -177,3 +177,32 @@ trivia.cs: # 73| -1: [TypeMention] int # 73| 0: [LocalVariableAccess] access to local variable i # 73| 1: [IntLiteral] 1 +# 80| [Class] Tr5 +# 83| 5: [Method] M1 +# 83| -1: [TypeMention] Void +# 84| 4: [BlockStmt] {...} +# 88| 6: [Method] M2 +# 88| -1: [TypeMention] Void +# 89| 4: [BlockStmt] {...} +# 92| 7: [Field] F1 +# 92| -1: [TypeMention] int +# 92| 1: [AssignExpr] ... = ... +# 92| 0: [FieldAccess] access to field F1 +# 94| 1: [IntLiteral] 10 +# 98| 8: [Field] F2 +# 98| -1: [TypeMention] int +# 98| 1: [AssignExpr] ... = ... +# 98| 0: [FieldAccess] access to field F2 +# 98| 1: [IntLiteral] 0 +# 100| 9: [Property] P1 +# 100| -1: [TypeMention] int +# 102| 3: [Getter] get_P1 +# 104| 4: [Setter] set_P1 +#-----| 2: (Parameters) +# 104| 0: [Parameter] value +# 108| 10: [Property] P2 +# 108| -1: [TypeMention] int +# 108| 3: [Getter] get_P2 +# 108| 4: [Setter] set_P2 +#-----| 2: (Parameters) +# 108| 0: [Parameter] value diff --git a/csharp/ql/test/library-tests/comments/trivia.cs b/csharp/ql/test/library-tests/comments/trivia.cs index be670eac1c4..fe3f217c393 100644 --- a/csharp/ql/test/library-tests/comments/trivia.cs +++ b/csharp/ql/test/library-tests/comments/trivia.cs @@ -2,7 +2,7 @@ // Start of trivia.cs // Unassociated #define DEBUG - +#define DEBUG2 #undef DEBUG using System; @@ -75,4 +75,35 @@ class Tr4 var i = 2; #endif } -} \ No newline at end of file +} + +class Tr5 +{ +#if DEBUG2 + static void M1() + { + } +#endif + + static void M2() + { + } + + public int F1 +#if DEBUG2 += 10 +#endif +; + + public int F2 = 0; + + public int P1 + { + get; +#if DEBUG2 + set; +#endif + } + + public int P2 { get; set; } +} diff --git a/docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst b/docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst index da87b3d57d5..d4e242ede3e 100644 --- a/docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst +++ b/docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst @@ -56,6 +56,12 @@ You must specify: You can also specify: +- ``--sarif-category``: an identifying category for the results. Used when + you want to upload more than one set of results for a commit. + For example, when you use ``github upload-results`` to send results for more than one + language to the GitHub code scanning API. For more information about this use case, + see `Configuring CodeQL CLI in your CI system `__ in the GitHub documentation. + - .. include:: ../reusables/threads-query-execution.rst @@ -85,8 +91,8 @@ repositories. Running a single query ~~~~~~~~~~~~~~~~~~~~~~ -To run a single query over a JavaScript codebase, you could use the following -command from the directory containing your database:: +To run a single query over a CodeQL database for a JavaScript codebase, +you could use the following command from the directory containing your database:: codeql database analyze ../ql/javascript/ql/src/Declarations/UnusedVariable.ql --format=csv --output=js-analysis/js-results.csv @@ -105,13 +111,23 @@ see ":doc:`Using custom queries with the CodeQL CLI `__. The query suites are located at the following paths in + codeql database analyze cpp-code-scanning.qls --format=sarifv2.1.0 --output=cpp-results.sarif + +The analysis generates a file in the v2.1.0 SARIF format that is supported by all versions of GitHub. +This file can be uploaded to GitHub using ``github upload-results`` or the code scanning API. +For more information, see `Analyzing a CodeQL database `__ +or `Code scanning API `__ in the GitHub documentation. + +CodeQL query suites are ``.qls`` files that use directives to select queries to run +based on certain metadata properties. The standard QL packs have metadata that specify +the location of the code scanning suites, so the CodeQL CLI knows where to find these +suite files automatically, and you don't have to specify the full path on the command line. +For more information, see ":ref:`About QL packs `." + +The standard query suites are stored at the following paths in the CodeQL repository:: ql//ql/src/codeql-suites/-code-scanning.qls @@ -120,23 +136,6 @@ and at the following path in the CodeQL for Go repository:: ql/src/codeql-suites/go-code-scanning.qls -These locations are specified in the metadata included in the standard QL packs. -This means that the CodeQL CLI knows where to find the suite files automatically, and -you don't have to specify the full path on the command line when running an -analysis. For more information, see ":ref:`About QL packs `." - -.. pull-quote:: - - Important - - If you plan to upload the results to GitHub, you must generate SARIF results. - For more information, see `Analyzing a CodeQL database `__ in the GitHub documentation. - -For example, to run the code scanning query suite on a C++ codebase and generate -results in the v2.1 SARIF format supported by all versions of GitHub, you would run:: - - codeql database analyze cpp-code-scanning.qls --format=sarifv2.1.0 --output=cpp-analysis/cpp-results.sarif - The repository also includes the query suites used by `LGTM.com `__. These are stored alongside the code scanning suites with names of the form: ``-lgtm.qls``. diff --git a/docs/codeql/codeql-cli/creating-codeql-databases.rst b/docs/codeql/codeql-cli/creating-codeql-databases.rst index 637df58555b..fd5f54505ef 100644 --- a/docs/codeql/codeql-cli/creating-codeql-databases.rst +++ b/docs/codeql/codeql-cli/creating-codeql-databases.rst @@ -17,6 +17,12 @@ Before you generate a CodeQL database, you need to: - Check out the version of your codebase you want to analyze. The directory should be ready to build, with all dependencies already installed. +For information about using the CodeQL CLI in a third-party CI system to create results +to display in GitHub as code scanning alerts, see `Configuring CodeQL CLI in your CI system `__ +in the GitHub documentation. For information about enabling CodeQL code scanning using GitHub Actions, +see `Setting up code scanning for a repository `__ +in the GitHub documentation. + Running ``codeql database create`` ---------------------------------- @@ -33,21 +39,30 @@ You must specify: be created when you execute the command---you cannot specify an existing directory. - ``--language``: the identifier for the language to create a database for. + When used with ``--db-cluster``, the option accepts a comma-separated list, + or can be specified more than once. CodeQL supports creating databases for the following languages: .. include:: ../reusables/extractors.rst -Other options may be specified depending on the location of your source file and -the language you want to analyze: +You can specify additional options depending on the location of your source file, +if the code needs to be compiled, and if you want to create CodeQL databases for +more than one language: - ``--source-root``: the root folder for the primary source files used in database creation. By default, the command assumes that the current directory is the source root---use this option to specify a different location. -- ``--command``: for compiled languages only, the build commands that invoke the - compiler. Do not specify ``--command`` options for Python and - JavaScript. Commands will be run from the current folder, or ``--source-root`` +- ``--db-cluster``: use for multi-language codebases when you want to create + databases for more than one language. +- ``--command``: used when you create a database for one or more compiled languages, + omit if the only languages requested are Python and JavaScript. + This specifies the build commands needed to invoke the compiler. + Commands are run from the current folder, or ``--source-root`` if specified. If you don't include a ``--command``, CodeQL will attempt to detect the build system automatically, using a built-in autobuilder. +- ``--no-run-unnecessary-builds``: used with ``--db-cluster`` to suppress the build + command for languages where the CodeQL CLI does not need to monitor the build + (for example, Python and JavaScript/TypeScript). For full details of all the options you can use when creating databases, see the `database create reference documentation <../manual/database-create>`__. @@ -62,31 +77,13 @@ it failed. For compiled languages, the console will display the output of the build system. When the database is successfully created, you'll find a new directory at the -path specified in the command. This directory contains a number of +path specified in the command. If you used the ``--db-cluster`` option to create +more than one database, a subdirectory is created for each language. +Each CodeQL database directory contains a number of subdirectories, including the relational data (required for analysis) and a source archive---a copy of the source files made at the time the database was created---which is used for displaying analysis results. -Obtaining databases from LGTM.com ---------------------------------- - -`LGTM.com `__ analyzes thousands of open-source projects using -CodeQL. For each project on LGTM.com, you can download an archived CodeQL -database corresponding to the most recently analyzed revision of the code. These -databases can also be analyzed using the CodeQL CLI. - -.. include:: ../reusables/download-lgtm-database.rst - -Before running an analysis, unzip the databases and try :doc:`upgrading ` the -unzipped databases to ensure they are compatible with your local copy of the -CodeQL queries and libraries. - -.. pull-quote:: - - Note - - .. include:: ../reusables/index-files-note.rst - Creating databases for non-compiled languages --------------------------------------------- @@ -99,9 +96,11 @@ are available. .. pull-quote:: Important - When running ``database create`` for JavaScript, TypeScript, and Python, you must not - specify a ``--command`` option. If you do, you will override the normal - extractor invocation, which will create an empty database. + When you run ``database create`` for JavaScript, TypeScript, and Python, you should not + specify a ``--command`` option. Otherwise this overrides the normal + extractor invocation, which will create an empty database. If you create + databases for multiple languages and one of them is a compiled language, + use the ``--no-run-unnecessary-builds`` option to skip the command for the languages that don't need to be compiled. JavaScript and TypeScript ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -229,6 +228,27 @@ commands that you can specify for compiled languages. This command runs a custom script that contains all of the commands required to build the project. +Obtaining databases from LGTM.com +--------------------------------- + +`LGTM.com `__ analyzes thousands of open-source projects using +CodeQL. For each project on LGTM.com, you can download an archived CodeQL +database corresponding to the most recently analyzed revision of the code. These +databases can also be analyzed using the CodeQL CLI or used with the CodeQL +extension for Visual Studio Code. + +.. include:: ../reusables/download-lgtm-database.rst + +Before running an analysis, unzip the databases and try :doc:`upgrading ` the +unzipped databases to ensure they are compatible with your local copy of the +CodeQL queries and libraries. + +.. pull-quote:: + + Note + + .. include:: ../reusables/index-files-note.rst + Further reading --------------- diff --git a/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst b/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst index 53d08e41d72..c9bcbe5d6c5 100644 --- a/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst +++ b/docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst @@ -22,6 +22,11 @@ follow the steps below. For macOS version 10.15 ("Catalina"), steps 1 and 4 are slightly different---for further details, see the sections labeled **Information for macOS "Catalina" users**. +For information about installing the CodeQL CLI in a CI system to create results +to display in GitHub as code scanning alerts, see +`Installing CodeQL CLI in your CI system `__ +in the GitHub documentation. + 1. Download the CodeQL CLI zip package ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/codeql/writing-codeql-queries/about-codeql-queries.rst b/docs/codeql/writing-codeql-queries/about-codeql-queries.rst index cd36acd2ac8..fc7da3b67bb 100644 --- a/docs/codeql/writing-codeql-queries/about-codeql-queries.rst +++ b/docs/codeql/writing-codeql-queries/about-codeql-queries.rst @@ -13,7 +13,7 @@ CodeQL includes queries to find the most relevant and interesting problems for e - **Alert queries**: queries that highlight issues in specific locations in your code. - **Path queries**: queries that describe the flow of information between a source and a sink in your code. -You can add custom queries to :doc:`QL packs <../codeql-cli/about-ql-packs>` to analyze your projects with "`Code scanning `__", use them to analyze a database with the ":ref:`CodeQL CLI `," or you can contribute to the standard CodeQL queries in our `open source repository on GitHub `__. +You can add custom queries to :doc:`QL packs <../codeql-cli/about-ql-packs>` to analyze your projects with "`Code scanning `__", use them to analyze a database with the ":ref:`CodeQL CLI `," or you can contribute to the standard CodeQL queries in our `open source repository on GitHub `__. This topic is a basic introduction to query files. You can find more information on writing queries for specific programming languages in the ":ref:`CodeQL language guides `," and detailed technical information about QL in the ":ref:`QL language reference `." For more information on how to format your code when contributing queries to the GitHub repository, see the `CodeQL style guide `__. diff --git a/java/change-notes/2021-05-31-add-spring-stringutils.md b/java/change-notes/2021-05-31-add-spring-stringutils.md new file mode 100644 index 00000000000..f0e971b7f65 --- /dev/null +++ b/java/change-notes/2021-05-31-add-spring-stringutils.md @@ -0,0 +1,2 @@ +lgtm,codescanning +* Added additional taint steps modeling the Spring `util` package (`org.springframework.util`). diff --git a/java/documentation/library-coverage/coverage.csv b/java/documentation/library-coverage/coverage.csv index b7b83a6c217..82c055e014e 100644 --- a/java/documentation/library-coverage/coverage.csv +++ b/java/documentation/library-coverage/coverage.csv @@ -1,44 +1,50 @@ -package,sink,source,summary,sink:bean-validation,sink:create-file,sink:header-splitting,sink:information-leak,sink:jexl,sink:ldap,sink:open-url,sink:set-hostname-verifier,sink:url-open-stream,sink:xpath,sink:xss,source:remote,summary:taint,summary:value -android.util,,16,,,,,,,,,,,,,16,, -android.webkit,3,2,,,,,,,,,,,,3,2,, -com.esotericsoftware.kryo.io,,,1,,,,,,,,,,,,,1, -com.esotericsoftware.kryo5.io,,,1,,,,,,,,,,,,,1, -com.fasterxml.jackson.databind,,,3,,,,,,,,,,,,,3, -com.google.common.base,,,34,,,,,,,,,,,,,28,6 -com.google.common.io,6,,73,,,,,,,,,6,,,,72,1 -com.unboundid.ldap.sdk,17,,,,,,,,17,,,,,,,, -java.beans,,,1,,,,,,,,,,,,,1, -java.io,3,,20,,3,,,,,,,,,,,20, -java.lang,,,3,,,,,,,,,,,,,1,2 -java.net,2,3,4,,,,,,,2,,,,,3,4, -java.nio,10,,2,,10,,,,,,,,,,,2, -java.util,,,283,,,,,,,,,,,,,15,268 -javax.naming.directory,1,,,,,,,,1,,,,,,,, -javax.net.ssl,2,,,,,,,,,,2,,,,,, -javax.servlet,4,21,2,,,3,1,,,,,,,,21,2, -javax.validation,1,1,,1,,,,,,,,,,,1,, -javax.ws.rs.core,1,,,,,1,,,,,,,,,,, -javax.xml.transform.sax,,,4,,,,,,,,,,,,,4, -javax.xml.transform.stream,,,2,,,,,,,,,,,,,2, -javax.xml.xpath,3,,,,,,,,,,,,3,,,, -org.apache.commons.codec,,,2,,,,,,,,,,,,,2, -org.apache.commons.io,,,22,,,,,,,,,,,,,22, -org.apache.commons.jexl2,15,,,,,,,15,,,,,,,,, -org.apache.commons.jexl3,15,,,,,,,15,,,,,,,,, -org.apache.commons.lang3,,,370,,,,,,,,,,,,,324,46 -org.apache.commons.text,,,272,,,,,,,,,,,,,220,52 -org.apache.directory.ldap.client.api,1,,,,,,,,1,,,,,,,, -org.apache.hc.core5.function,,,1,,,,,,,,,,,,,1, -org.apache.hc.core5.http,1,2,39,,,,,,,,,,,1,2,39, -org.apache.hc.core5.net,,,2,,,,,,,,,,,,,2, -org.apache.hc.core5.util,,,24,,,,,,,,,,,,,18,6 -org.apache.http,2,3,67,,,,,,,,,,,2,3,59,8 -org.dom4j,20,,,,,,,,,,,,20,,,, -org.springframework.ldap.core,14,,,,,,,,14,,,,,,,, -org.springframework.security.web.savedrequest,,6,,,,,,,,,,,,,6,, -org.springframework.web.client,,3,,,,,,,,,,,,,3,, -org.springframework.web.context.request,,8,,,,,,,,,,,,,8,, -org.springframework.web.multipart,,12,,,,,,,,,,,,,12,, -org.xml.sax,,,1,,,,,,,,,,,,,1, -org.xmlpull.v1,,3,,,,,,,,,,,,,3,, -play.mvc,,4,,,,,,,,,,,,,4,, +package,sink,source,summary,sink:bean-validation,sink:create-file,sink:header-splitting,sink:information-leak,sink:jexl,sink:ldap,sink:open-url,sink:set-hostname-verifier,sink:url-open-stream,sink:url-redirect,sink:xpath,sink:xss,source:remote,summary:taint,summary:value +android.util,,16,,,,,,,,,,,,,,16,, +android.webkit,3,2,,,,,,,,,,,,,3,2,, +com.esotericsoftware.kryo.io,,,1,,,,,,,,,,,,,,1, +com.esotericsoftware.kryo5.io,,,1,,,,,,,,,,,,,,1, +com.fasterxml.jackson.databind,,,3,,,,,,,,,,,,,,3, +com.google.common.base,,,85,,,,,,,,,,,,,,62,23 +com.google.common.io,6,,73,,,,,,,,,6,,,,,72,1 +com.unboundid.ldap.sdk,17,,,,,,,,17,,,,,,,,, +jakarta.ws.rs.client,1,,,,,,,,,1,,,,,,,, +jakarta.ws.rs.core,2,,143,,,,,,,,,,2,,,,88,55 +java.beans,,,1,,,,,,,,,,,,,,1, +java.io,3,,20,,3,,,,,,,,,,,,20, +java.lang,,,3,,,,,,,,,,,,,,1,2 +java.net,4,3,6,,,,,,,4,,,,,,3,6, +java.nio,10,,2,,10,,,,,,,,,,,,2, +java.util,,,295,,,,,,,,,,,,,,15,280 +javax.naming.directory,1,,,,,,,,1,,,,,,,,, +javax.net.ssl,2,,,,,,,,,,2,,,,,,, +javax.servlet,4,21,2,,,3,1,,,,,,,,,21,2, +javax.validation,1,1,,1,,,,,,,,,,,,1,, +javax.ws.rs.client,1,,,,,,,,,1,,,,,,,, +javax.ws.rs.core,3,,143,,,1,,,,,,,2,,,,88,55 +javax.xml.transform.sax,,,4,,,,,,,,,,,,,,4, +javax.xml.transform.stream,,,2,,,,,,,,,,,,,,2, +javax.xml.xpath,3,,,,,,,,,,,,,3,,,, +org.apache.commons.codec,,,2,,,,,,,,,,,,,,2, +org.apache.commons.collections,,,99,,,,,,,,,,,,,,4,95 +org.apache.commons.collections4,,,99,,,,,,,,,,,,,,4,95 +org.apache.commons.io,,,22,,,,,,,,,,,,,,22, +org.apache.commons.jexl2,15,,,,,,,15,,,,,,,,,, +org.apache.commons.jexl3,15,,,,,,,15,,,,,,,,,, +org.apache.commons.lang3,,,420,,,,,,,,,,,,,,292,128 +org.apache.commons.text,,,272,,,,,,,,,,,,,,220,52 +org.apache.directory.ldap.client.api,1,,,,,,,,1,,,,,,,,, +org.apache.hc.core5.function,,,1,,,,,,,,,,,,,,1, +org.apache.hc.core5.http,1,2,39,,,,,,,,,,,,1,2,39, +org.apache.hc.core5.net,,,2,,,,,,,,,,,,,,2, +org.apache.hc.core5.util,,,24,,,,,,,,,,,,,,18,6 +org.apache.http,27,3,70,,,,,,,25,,,,,2,3,62,8 +org.dom4j,20,,,,,,,,,,,,,20,,,, +org.springframework.http,14,,,,,,,,,14,,,,,,,, +org.springframework.ldap.core,14,,,,,,,,14,,,,,,,,, +org.springframework.security.web.savedrequest,,6,,,,,,,,,,,,,,6,, +org.springframework.web.client,13,3,,,,,,,,13,,,,,,3,, +org.springframework.web.context.request,,8,,,,,,,,,,,,,,8,, +org.springframework.web.multipart,,12,,,,,,,,,,,,,,12,, +org.xml.sax,,,1,,,,,,,,,,,,,,1, +org.xmlpull.v1,,3,,,,,,,,,,,,,,3,, +play.mvc,,4,,,,,,,,,,,,,,4,, diff --git a/java/documentation/library-coverage/coverage.rst b/java/documentation/library-coverage/coverage.rst index c99a41d3be2..1030189c54a 100644 --- a/java/documentation/library-coverage/coverage.rst +++ b/java/documentation/library-coverage/coverage.rst @@ -8,14 +8,15 @@ Java framework & library support Framework / library,Package,Remote flow sources,Taint & value steps,Sinks (total),`CWE‑022` :sub:`Path injection`,`CWE‑036` :sub:`Path traversal`,`CWE‑079` :sub:`Cross-site scripting`,`CWE‑089` :sub:`SQL injection`,`CWE‑090` :sub:`LDAP injection`,`CWE‑094` :sub:`Code injection`,`CWE‑319` :sub:`Cleartext transmission` Android,``android.*``,18,,3,,,3,,,, + `Apache Commons Collections `_,"``org.apache.commons.collections``, ``org.apache.commons.collections4``",,198,,,,,,,, `Apache Commons IO `_,``org.apache.commons.io``,,22,,,,,,,, - `Apache Commons Lang `_,``org.apache.commons.lang3``,,370,,,,,,,, + `Apache Commons Lang `_,``org.apache.commons.lang3``,,420,,,,,,,, `Apache Commons Text `_,``org.apache.commons.text``,,272,,,,,,,, - `Apache HttpComponents `_,"``org.apache.hc.core5.*``, ``org.apache.http``",5,133,3,,,3,,,, - `Google Guava `_,``com.google.common.*``,,107,6,,6,,,,, - Java Standard Library,``java.*``,3,313,15,13,,,,,,2 - Java extensions,``javax.*``,22,8,12,,,,,1,1, - `Spring `_,``org.springframework.*``,29,,14,,,,,14,, - Others,"``com.esotericsoftware.kryo.io``, ``com.esotericsoftware.kryo5.io``, ``com.fasterxml.jackson.databind``, ``com.unboundid.ldap.sdk``, ``org.apache.commons.codec``, ``org.apache.commons.jexl2``, ``org.apache.commons.jexl3``, ``org.apache.directory.ldap.client.api``, ``org.dom4j``, ``org.xml.sax``, ``org.xmlpull.v1``, ``play.mvc``",7,8,68,,,,,18,, - Totals,,84,1233,121,13,6,6,,33,1,2 + `Apache HttpComponents `_,"``org.apache.hc.core5.*``, ``org.apache.http``",5,136,28,,,3,,,,25 + `Google Guava `_,``com.google.common.*``,,158,6,,6,,,,, + Java Standard Library,``java.*``,3,327,17,13,,,,,,4 + Java extensions,``javax.*``,22,151,15,,,,,1,1,1 + `Spring `_,``org.springframework.*``,29,,41,,,,,14,,27 + Others,"``com.esotericsoftware.kryo.io``, ``com.esotericsoftware.kryo5.io``, ``com.fasterxml.jackson.databind``, ``com.unboundid.ldap.sdk``, ``jakarta.ws.rs.client``, ``jakarta.ws.rs.core``, ``org.apache.commons.codec``, ``org.apache.commons.jexl2``, ``org.apache.commons.jexl3``, ``org.apache.directory.ldap.client.api``, ``org.dom4j``, ``org.xml.sax``, ``org.xmlpull.v1``, ``play.mvc``",7,151,71,,,,,18,,1 + Totals,,84,1835,181,13,6,6,,33,1,58 diff --git a/java/documentation/library-coverage/frameworks.csv b/java/documentation/library-coverage/frameworks.csv index de139173fc0..bd5feddb8ed 100644 --- a/java/documentation/library-coverage/frameworks.csv +++ b/java/documentation/library-coverage/frameworks.csv @@ -1,6 +1,6 @@ Framework name,URL,Package prefixes Java Standard Library,,java.* -Java extensions,,javax.* +Java extensions,,javax.* jakarta.* Google Guava,https://guava.dev/,com.google.common.* Apache Commons Collections,https://commons.apache.org/proper/commons-collections/,org.apache.commons.collections org.apache.commons.collections4 Apache Commons IO,https://commons.apache.org/proper/commons-io/,org.apache.commons.io diff --git a/java/ql/src/config/semmlecode.dbscheme b/java/ql/src/config/semmlecode.dbscheme index 60a4ba1a475..b4e689c9042 100755 --- a/java/ql/src/config/semmlecode.dbscheme +++ b/java/ql/src/config/semmlecode.dbscheme @@ -479,6 +479,11 @@ implInterface( int id2: @interface ref ); +permits( + int id1: @classorinterface ref, + int id2: @classorinterface ref +); + hasModifier( int id1: @modifiable ref, int id2: @modifier ref diff --git a/java/ql/src/config/semmlecode.dbscheme.stats b/java/ql/src/config/semmlecode.dbscheme.stats index 6b9f21c5f71..cccd0da8b75 100644 --- a/java/ql/src/config/semmlecode.dbscheme.stats +++ b/java/ql/src/config/semmlecode.dbscheme.stats @@ -17639,6 +17639,64 @@ +permits +16 + + +id1 +6 + + +id2 +16 + + + + +id1 +id2 + + +12 + + +1 +2 +2 + + +3 +4 +2 + + +4 +5 +2 + + + + + + +id2 +id1 + + +12 + + +1 +2 +16 + + + + + + + + hasModifier 5667539 diff --git a/java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll b/java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll index 271816bc543..f1a17c05723 100644 --- a/java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll +++ b/java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll @@ -85,6 +85,7 @@ private module Frameworks { private import semmle.code.java.frameworks.JaxWS private import semmle.code.java.frameworks.Optional private import semmle.code.java.frameworks.spring.SpringHttp + private import semmle.code.java.frameworks.spring.SpringUtil private import semmle.code.java.frameworks.spring.SpringWebClient private import semmle.code.java.frameworks.spring.SpringBeans private import semmle.code.java.security.ResponseSplitting diff --git a/java/ql/src/semmle/code/java/frameworks/spring/Spring.qll b/java/ql/src/semmle/code/java/frameworks/spring/Spring.qll index 648b9beb0a0..8a80e6a43d4 100644 --- a/java/ql/src/semmle/code/java/frameworks/spring/Spring.qll +++ b/java/ql/src/semmle/code/java/frameworks/spring/Spring.qll @@ -33,6 +33,7 @@ import semmle.code.java.frameworks.spring.SpringQualifier import semmle.code.java.frameworks.spring.SpringRef import semmle.code.java.frameworks.spring.SpringReplacedMethod import semmle.code.java.frameworks.spring.SpringSet +import semmle.code.java.frameworks.spring.SpringUtil import semmle.code.java.frameworks.spring.SpringValue import semmle.code.java.frameworks.spring.SpringXMLElement import semmle.code.java.frameworks.spring.metrics.MetricSpringBean diff --git a/java/ql/src/semmle/code/java/frameworks/spring/SpringUtil.qll b/java/ql/src/semmle/code/java/frameworks/spring/SpringUtil.qll new file mode 100644 index 00000000000..e7029999098 --- /dev/null +++ b/java/ql/src/semmle/code/java/frameworks/spring/SpringUtil.qll @@ -0,0 +1,153 @@ +/** + * Provides models for the `org.springframework.util` package. + */ + +import java +private import semmle.code.java.dataflow.ExternalFlow + +private class FlowSummaries extends SummaryModelCsv { + override predicate row(string row) { + row = + [ + "org.springframework.util;AntPathMatcher;false;combine;;;Argument[0..1];ReturnValue;taint", + "org.springframework.util;AntPathMatcher;false;doMatch;;;Argument[1];MapValue of Argument[3];taint", + "org.springframework.util;AntPathMatcher;false;extractPathWithinPattern;;;Argument[1];ReturnValue;taint", + "org.springframework.util;AntPathMatcher;false;extractUriTemplateVariables;;;Argument[1];MapValue of ReturnValue;taint", + "org.springframework.util;AntPathMatcher;false;tokenizePath;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;AntPathMatcher;false;tokenizePattern;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;AutoPopulatingList;false;AutoPopulatingList;(java.util.List,org.springframework.util.AutoPopulatingList.ElementFactory);;Element of Argument[0];Element of Argument[-1];value", + "org.springframework.util;AutoPopulatingList;false;AutoPopulatingList;(java.util.List,java.lang.Class);;Element of Argument[0];Element of Argument[-1];value", + "org.springframework.util;Base64Utils;false;decode;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;decodeFromString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;decodeFromUrlSafeString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;decodeUrlSafe;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;encode;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;encodeToString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;encodeToUrlSafeString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;Base64Utils;false;encodeUrlSafe;;;Argument[0];ReturnValue;taint", + "org.springframework.util;CollectionUtils;false;arrayToList;;;ArrayElement of Argument[0];Element of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;findFirstMatch;;;Element of Argument[0];ReturnValue;value", + "org.springframework.util;CollectionUtils;false;findValueOfType;;;Element of Argument[0];ReturnValue;value", + "org.springframework.util;CollectionUtils;false;firstElement;;;Element of Argument[0];ReturnValue;value", + "org.springframework.util;CollectionUtils;false;lastElement;;;Element of Argument[0];ReturnValue;value", + "org.springframework.util;CollectionUtils;false;mergeArrayIntoCollection;;;ArrayElement of Argument[0];Element of Argument[1];value", + "org.springframework.util;CollectionUtils;false;mergePropertiesIntoMap;;;MapKey of Argument[0];MapKey of Argument[1];value", + "org.springframework.util;CollectionUtils;false;mergePropertiesIntoMap;;;MapValue of Argument[0];MapValue of Argument[1];value", + "org.springframework.util;CollectionUtils;false;toArray;;;Element of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;toIterator;;;Element of Argument[0];Element of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;toMultiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;toMultiValueMap;;;Element of MapValue of Argument[0];Element of MapValue of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;unmodifiableMultiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value", + "org.springframework.util;CollectionUtils;false;unmodifiableMultiValueMap;;;MapValue of Argument[0];MapValue of ReturnValue;value", + "org.springframework.util;CompositeIterator;false;add;;;Element of Argument[0];Element of Argument[-1];value", + "org.springframework.util;ConcurrentReferenceHashMap;false;getReference;;;MapKey of Argument[-1];MapKey of ReturnValue;value", + "org.springframework.util;ConcurrentReferenceHashMap;false;getReference;;;MapValue of Argument[-1];MapValue of ReturnValue;value", + "org.springframework.util;ConcurrentReferenceHashMap;false;getSegment;;;MapKey of Argument[-1];MapKey of ReturnValue;value", + "org.springframework.util;ConcurrentReferenceHashMap;false;getSegment;;;MapValue of Argument[-1];MapValue of ReturnValue;value", + "org.springframework.util;FastByteArrayOutputStream;false;getInputStream;;;Argument[-1];ReturnValue;taint", + "org.springframework.util;FastByteArrayOutputStream;false;toByteArray;;;Argument[-1];ReturnValue;taint", + "org.springframework.util;FastByteArrayOutputStream;false;write;;;Argument[0];Argument[-1];taint", + "org.springframework.util;FastByteArrayOutputStream;false;writeTo;;;Argument[-1];Argument[0];taint", + "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint", + "org.springframework.util;FileCopyUtils;false;copyToByteArray;;;Argument[0];ReturnValue;taint", + "org.springframework.util;FileCopyUtils;false;copyToString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;FileSystemUtils;false;copyRecursively;(java.io.File,java.io.File);;Argument[0];Argument[1];taint", + "org.springframework.util;LinkedMultiValueMap;false;LinkedMultiValueMap;(java.util.Map);;MapKey of Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;LinkedMultiValueMap;false;LinkedMultiValueMap;(java.util.Map);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value", + "org.springframework.util;LinkedMultiValueMap;false;deepCopy;;;MapKey of Argument[-1];MapKey of ReturnValue;value", + "org.springframework.util;LinkedMultiValueMap;false;deepCopy;;;MapValue of Argument[-1];MapValue of ReturnValue;value", + "org.springframework.util;MultiValueMap;true;add;;;Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;add;;;Argument[1];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Element of Argument[1];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;MapKey of Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[1];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;getFirst;;;Element of MapValue of Argument[-1];ReturnValue;value", + "org.springframework.util;MultiValueMap;true;set;;;Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;set;;;Argument[1];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;setAll;;;MapKey of Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;setAll;;;MapValue of Argument[0];Element of MapValue of Argument[-1];value", + "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;MapKey of Argument[-1];MapKey of ReturnValue;value", + "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;Element of MapValue of Argument[-1];MapValue of ReturnValue;value", + "org.springframework.util;MultiValueMapAdapter;false;MultiValueMapAdapter;;;MapKey of Argument[0];MapKey of Argument[-1];value", + "org.springframework.util;MultiValueMapAdapter;false;MultiValueMapAdapter;;;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value", + "org.springframework.util;ObjectUtils;false;addObjectToArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;ObjectUtils;false;addObjectToArray;;;Argument[1];ArrayElement of ReturnValue;value", + "org.springframework.util;ObjectUtils;false;toObjectArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;ObjectUtils;false;unwrapOptional;;;Element of Argument[0];ReturnValue;value", + "org.springframework.util;PropertiesPersister;true;load;;;Argument[1];Argument[0];taint", + "org.springframework.util;PropertiesPersister;true;loadFromXml;;;Argument[1];Argument[0];taint", + "org.springframework.util;PropertiesPersister;true;store;;;Argument[0];Argument[1];taint", + "org.springframework.util;PropertiesPersister;true;store;;;Argument[2];Argument[1];taint", + "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[0];Argument[1];taint", + "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[2];Argument[1];taint", + "org.springframework.util;PropertyPlaceholderHelper;false;PropertyPlaceholderHelper;;;Argument[0..1];Argument[-1];taint", + "org.springframework.util;PropertyPlaceholderHelper;false;parseStringValue;;;Argument[0];ReturnValue;taint", + "org.springframework.util;PropertyPlaceholderHelper;false;replacePlaceholders;;;Argument[0];ReturnValue;taint", + "org.springframework.util;PropertyPlaceholderHelper;false;replacePlaceholders;(java.lang.String,java.util.Properties);;MapValue of Argument[1];ReturnValue;taint", + "org.springframework.util;ResourceUtils;false;extractArchiveURL;;;Argument[0];ReturnValue;taint", + "org.springframework.util;ResourceUtils;false;extractJarFileURL;;;Argument[0];ReturnValue;taint", + "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint", + "org.springframework.util;ResourceUtils;false;getURL;;;Argument[0];ReturnValue;taint", + "org.springframework.util;ResourceUtils;false;toURI;;;Argument[0];ReturnValue;taint", + "org.springframework.util;RouteMatcher;true;combine;;;Argument[0..1];ReturnValue;taint", + "org.springframework.util;RouteMatcher;true;matchAndExtract;;;Argument[0];MapKey of ReturnValue;taint", + "org.springframework.util;RouteMatcher;true;matchAndExtract;;;Argument[1];MapValue of ReturnValue;taint", + "org.springframework.util;RouteMatcher;true;parseRoute;;;Argument[0];ReturnValue;taint", + "org.springframework.util;SerializationUtils;false;deserialize;;;Argument[0];ReturnValue;taint", + "org.springframework.util;SerializationUtils;false;serialize;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StreamUtils;false;copy;(byte[],java.io.OutputStream);;Argument[0];Argument[1];taint", + "org.springframework.util;StreamUtils;false;copy;(java.io.InputStream,java.io.OutputStream);;Argument[0];Argument[1];taint", + "org.springframework.util;StreamUtils;false;copy;(java.lang.String,java.nio.charset.Charset,java.io.OutputStream);;Argument[0];Argument[2];taint", + "org.springframework.util;StreamUtils;false;copyRange;;;Argument[0];Argument[1];taint", + "org.springframework.util;StreamUtils;false;copyToByteArray;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StreamUtils;false;copyToString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;addStringToArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;addStringToArray;;;Argument[1];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;applyRelativePath;;;Argument[0..1];ReturnValue;taint", + "org.springframework.util;StringUtils;false;arrayToCommaDelimitedString;;;ArrayElement of Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;arrayToDelimitedString;;;ArrayElement of Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;arrayToDelimitedString;;;Argument[1];ReturnValue;taint", + "org.springframework.util;StringUtils;false;capitalize;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;cleanPath;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;collectionToCommaDelimitedString;;;Element of Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Element of Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Argument[1..3];ReturnValue;taint", + "org.springframework.util;StringUtils;false;commaDelimitedListToSet;;;Argument[0];Element of ReturnValue;taint", + "org.springframework.util;StringUtils;false;commaDelimitedListToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;concatenateStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;delete;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;deleteAny;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;delimitedListToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;getFilename;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;getFilenameExtension;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;mergeStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;quote;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;quoteIfString;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;removeDuplicateStrings;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;replace;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;replace;;;Argument[2];ReturnValue;taint", + "org.springframework.util;StringUtils;false;sortStringArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;split;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;splitArrayElementsIntoProperties;;;ArrayElement of Argument[0];MapKey of ReturnValue;taint", + "org.springframework.util;StringUtils;false;splitArrayElementsIntoProperties;;;ArrayElement of Argument[0];MapValue of ReturnValue;taint", + "org.springframework.util;StringUtils;false;stripFilenameExtension;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;tokenizeToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;toStringArray;;;Element of Argument[0];ArrayElement of ReturnValue;value", + "org.springframework.util;StringUtils;false;trimAllWhitespace;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimArrayElements;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimLeadingCharacter;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimLeadingWhitespace;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimTrailingCharacter;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimTrailingWhitespace;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;trimWhitespace;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;uncapitalize;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;unqualify;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringUtils;false;uriDecode;;;Argument[0];ReturnValue;taint", + "org.springframework.util;StringValueResolver;false;resolveStringValue;;;Argument[0];ReturnValue;taint", + "org.springframework.util;SystemPropertyUtils;false;resolvePlaceholders;;;Argument[0];ReturnValue;taint" + ] + } +} diff --git a/java/ql/test/experimental/query-tests/security/CWE-016/options b/java/ql/test/experimental/query-tests/security/CWE-016/options index 3ebc054c664..06ec85dc706 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-016/options +++ b/java/ql/test/experimental/query-tests/security/CWE-016/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8 diff --git a/java/ql/test/experimental/query-tests/security/CWE-074-JndiInjection/options b/java/ql/test/experimental/query-tests/security/CWE-074-JndiInjection/options index 6ce8be3e7f5..3fab778b3d9 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-074-JndiInjection/options +++ b/java/ql/test/experimental/query-tests/security/CWE-074-JndiInjection/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/shiro-core-1.5.2:${testdir}/../../../../stubs/spring-ldap-2.3.2 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/shiro-core-1.5.2:${testdir}/../../../../stubs/spring-ldap-2.3.2 diff --git a/java/ql/test/experimental/query-tests/security/CWE-074/options b/java/ql/test/experimental/query-tests/security/CWE-074/options index 9d29696af33..599f2f5f14a 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-074/options +++ b/java/ql/test/experimental/query-tests/security/CWE-074/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/Saxon-HE-9.9.1-7 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/Saxon-HE-9.9.1-7 diff --git a/java/ql/test/experimental/query-tests/security/CWE-094/options b/java/ql/test/experimental/query-tests/security/CWE-094/options index d54ac82b606..e376236f8a8 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-094/options +++ b/java/ql/test/experimental/query-tests/security/CWE-094/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3:${testdir}/../../../../stubs/mvel2-2.4.7:${testdir}/../../../../stubs/jsr223-api:${testdir}/../../../../stubs/scriptengine:${testdir}/../../../../stubs/java-ee-el:${testdir}/../../../../stubs/juel-2.2:${testdir}/../../../stubs/groovy-all-3.0.7:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/jython-2.7.2:${testdir}/../../../../experimental/stubs/rhino-1.7.13:${testdir}/../../../../stubs/bsh-2.0b5:${testdir}/../../../../experimental/stubs/jshell \ No newline at end of file +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8:${testdir}/../../../../stubs/mvel2-2.4.7:${testdir}/../../../../stubs/jsr223-api:${testdir}/../../../../stubs/scriptengine:${testdir}/../../../../stubs/java-ee-el:${testdir}/../../../../stubs/juel-2.2:${testdir}/../../../stubs/groovy-all-3.0.7:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/jython-2.7.2:${testdir}/../../../../experimental/stubs/rhino-1.7.13:${testdir}/../../../../stubs/bsh-2.0b5:${testdir}/../../../../experimental/stubs/jshell diff --git a/java/ql/test/experimental/query-tests/security/CWE-1004/options b/java/ql/test/experimental/query-tests/security/CWE-1004/options index d61a358d97f..4a9b588c832 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-1004/options +++ b/java/ql/test/experimental/query-tests/security/CWE-1004/options @@ -1 +1 @@ -// semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/jsr311-api-1.1.1:${testdir}/../../../../stubs/springframework-5.2.3 \ No newline at end of file +// semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/jsr311-api-1.1.1:${testdir}/../../../../stubs/springframework-5.3.8 \ No newline at end of file diff --git a/java/ql/test/experimental/query-tests/security/CWE-348/options b/java/ql/test/experimental/query-tests/security/CWE-348/options index 05f93394f49..65ba99fff23 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-348/options +++ b/java/ql/test/experimental/query-tests/security/CWE-348/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/springframework-5.2.3/:${testdir}/../../../../stubs/apache-commons-lang3-3.7/ \ No newline at end of file +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/springframework-5.3.8/:${testdir}/../../../../stubs/apache-commons-lang3-3.7/ \ No newline at end of file diff --git a/java/ql/test/experimental/query-tests/security/CWE-352/options b/java/ql/test/experimental/query-tests/security/CWE-352/options index 5e5f10f6945..ee5f43993f3 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-352/options +++ b/java/ql/test/experimental/query-tests/security/CWE-352/options @@ -1 +1 @@ - //semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/apache-http-4.4.13/:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/fastjson-1.2.74/:${testdir}/../../../../stubs/gson-2.8.6/:${testdir}/../../../../stubs/jackson-databind-2.10/:${testdir}/../../../../stubs/springframework-5.2.3/ + //semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/apache-http-4.4.13/:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/fastjson-1.2.74/:${testdir}/../../../../stubs/gson-2.8.6/:${testdir}/../../../../stubs/jackson-databind-2.10/:${testdir}/../../../../stubs/springframework-5.3.8/ diff --git a/java/ql/test/experimental/query-tests/security/CWE-502/options b/java/ql/test/experimental/query-tests/security/CWE-502/options index 31b8e3f6935..0c6ef357b21 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-502/options +++ b/java/ql/test/experimental/query-tests/security/CWE-502/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3 \ No newline at end of file +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8 \ No newline at end of file diff --git a/java/ql/test/experimental/query-tests/security/CWE-601/options b/java/ql/test/experimental/query-tests/security/CWE-601/options index a9289108747..ba166b547a0 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-601/options +++ b/java/ql/test/experimental/query-tests/security/CWE-601/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/springframework-5.2.3/ \ No newline at end of file +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/springframework-5.3.8/ \ No newline at end of file diff --git a/java/ql/test/experimental/query-tests/security/CWE-652/options b/java/ql/test/experimental/query-tests/security/CWE-652/options index 98e36c19267..53ad1f48883 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-652/options +++ b/java/ql/test/experimental/query-tests/security/CWE-652/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/apache-http-4.4.13/:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/saxon-xqj-9.x/:${testdir}/../../../../stubs/springframework-5.2.3/ +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/apache-http-4.4.13/:${testdir}/../../../../stubs/servlet-api-2.4:${testdir}/../../../../stubs/saxon-xqj-9.x/:${testdir}/../../../../stubs/springframework-5.3.8/ diff --git a/java/ql/test/experimental/query-tests/security/CWE-917/options b/java/ql/test/experimental/query-tests/security/CWE-917/options index ef63b56d84e..b29e21be7b4 100644 --- a/java/ql/test/experimental/query-tests/security/CWE-917/options +++ b/java/ql/test/experimental/query-tests/security/CWE-917/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/ognl-3.2.14:${testdir}/../../../stubs/struts2-core-2.5.22 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/ognl-3.2.14:${testdir}/../../../stubs/struts2-core-2.5.22 diff --git a/java/ql/test/library-tests/dataflow/taintsources/options b/java/ql/test/library-tests/dataflow/taintsources/options index 1230949dd48..be1eb3d91da 100644 --- a/java/ql/test/library-tests/dataflow/taintsources/options +++ b/java/ql/test/library-tests/dataflow/taintsources/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/google-android-9.0.0:${testdir}/../../../stubs/playframework-2.6.x:${testdir}/../../../stubs/jackson-databind-2.10:${testdir}/../../../stubs/akka-2.6.x +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/google-android-9.0.0:${testdir}/../../../stubs/playframework-2.6.x:${testdir}/../../../stubs/jackson-databind-2.10:${testdir}/../../../stubs/akka-2.6.x diff --git a/java/ql/test/library-tests/frameworks/JaxWs/JaxRs.ql b/java/ql/test/library-tests/frameworks/JaxWs/JaxRs.ql index 721d46672e9..fcd150e8cf5 100644 --- a/java/ql/test/library-tests/frameworks/JaxWs/JaxRs.ql +++ b/java/ql/test/library-tests/frameworks/JaxWs/JaxRs.ql @@ -24,8 +24,16 @@ class JaxRsTest extends InlineExpectationsTest { resourceMethod.getLocation() = location and element = resourceMethod.toString() and if exists(resourceMethod.getProducesAnnotation()) - then value = resourceMethod.getProducesAnnotation().getADeclaredContentType() - else value = "" + then + value = resourceMethod.getProducesAnnotation().getADeclaredContentType() and + value != "" + else + // Filter out empty strings that stem from using stubs. + // If we built the test against the real JAR then the field + // access against e.g. MediaType.APPLICATION_JSON wouldn't + // be a CompileTimeConstantExpr at all, whereas in the stubs + // it is and is defined empty. + value = "" ) or tag = "RootResourceClass" and @@ -135,7 +143,13 @@ class JaxRsTest extends InlineExpectationsTest { exists(JaxRSProducesAnnotation producesAnnotation | producesAnnotation.getLocation() = location and element = producesAnnotation.toString() and - value = producesAnnotation.getADeclaredContentType() + value = producesAnnotation.getADeclaredContentType() and + value != "" + // Filter out empty strings that stem from using stubs. + // If we built the test against the real JAR then the field + // access against e.g. MediaType.APPLICATION_JSON wouldn't + // be a CompileTimeConstantExpr at all, whereas in the stubs + // it is and is defined empty. ) or tag = "ConsumesAnnotation" and diff --git a/java/ql/test/library-tests/frameworks/spring/util/Test.java b/java/ql/test/library-tests/frameworks/spring/util/Test.java new file mode 100644 index 00000000000..59b18d5ea2f --- /dev/null +++ b/java/ql/test/library-tests/frameworks/spring/util/Test.java @@ -0,0 +1,1438 @@ +package generatedtest; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.Set; +import java.util.TreeMap; +import org.springframework.util.AntPathMatcher; +import org.springframework.util.AutoPopulatingList; +import org.springframework.util.Base64Utils; +import org.springframework.util.CollectionUtils; +import org.springframework.util.CompositeIterator; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.util.FileCopyUtils; +import org.springframework.util.FileSystemUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.MultiValueMapAdapter; +import org.springframework.util.ObjectUtils; +import org.springframework.util.PropertiesPersister; +import org.springframework.util.PropertyPlaceholderHelper; +import org.springframework.util.ResourceUtils; +import org.springframework.util.RouteMatcher; +import org.springframework.util.SerializationUtils; +import org.springframework.util.StreamUtils; +import org.springframework.util.StringUtils; +import org.springframework.util.StringValueResolver; +import org.springframework.util.SystemPropertyUtils; + +// Test case generated by GenerateFlowTestCase.ql +public class Test { + + E getArrayElement(E[] container) { return container[0]; } + E getElement(Collection container) { return container.iterator().next(); } + E getElement(Iterator container) { return container.next(); } + K getMapKey(Map container) { return container.keySet().iterator().next(); } + V getMapValue(Map container) { return container.get(null); } + Object[] newWithArrayElement(Object element) { return new Object[] {element}; } + Properties newPropertiesWithMapKey(Object element) { Properties p = new Properties(); p.put(element, null); return p; } + Properties newPropertiesWithMapValue(Object element) { Properties p = new Properties(); p.put(null, element); return p; } + static Object source() { return null; } + static void sink(Object o) { } + + // Test AntPathMatcher's protected methods: + private static class AntPathMatcherTest extends AntPathMatcher { + + public void test() throws Exception { + { + // "org.springframework.util;AntPathMatcher;false;doMatch;;;Argument[1];MapValue of Argument[3];taint" + Map out = new HashMap<>(); + String in = (String)source(); + this.doMatch("somePattern", in, true, out); + sink(out.get("someKey")); // $hasTaintFlow + } + { + // "org.springframework.util;AntPathMatcher;false;tokenizePath;;;Argument[0];ArrayValue of ReturnValue;taint", + String[] out = null; + String in = (String)source(); + out = this.tokenizePath(in); + sink(out[0]); // $hasTaintFlow + } + { + // "org.springframework.util;AntPathMatcher;false;tokenizePattern;;;Argument[0];ArrayValue of ReturnValue;taint", + String[] out = null; + String in = (String)source(); + out = this.tokenizePattern(in); + sink(out[0]); // $hasTaintFlow + } + } + + } + + public void test() throws Exception { + + { + // "org.springframework.util;AntPathMatcher;false;combine;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + AntPathMatcher instance = null; + out = instance.combine(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;AntPathMatcher;false;combine;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + AntPathMatcher instance = null; + out = instance.combine(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;AntPathMatcher;false;extractPathWithinPattern;;;Argument[1];ReturnValue;taint" + String out = null; + String in = (String)source(); + AntPathMatcher instance = null; + out = instance.extractPathWithinPattern(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;AntPathMatcher;false;extractUriTemplateVariables;;;Argument[1];MapValue of ReturnValue;taint" + Map out = null; + String in = (String)source(); + AntPathMatcher instance = null; + out = instance.extractUriTemplateVariables(null, in); + sink(getMapValue(out)); // $hasTaintFlow + } + { + // "org.springframework.util;AutoPopulatingList;false;AutoPopulatingList;(java.util.List,java.lang.Class);;Element of Argument[0];Element of Argument[-1];value" + AutoPopulatingList out = null; + List in = List.of(source()); + out = new AutoPopulatingList(in, (Class)null); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;AutoPopulatingList;false;AutoPopulatingList;(java.util.List,org.springframework.util.AutoPopulatingList.ElementFactory);;Element of Argument[0];Element of Argument[-1];value" + AutoPopulatingList out = null; + List in = List.of(source()); + out = new AutoPopulatingList(in, (AutoPopulatingList.ElementFactory)null); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;Base64Utils;false;decode;;;Argument[0];ReturnValue;taint" + byte[] out = null; + byte[] in = (byte[])source(); + out = Base64Utils.decode(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;decodeFromString;;;Argument[0];ReturnValue;taint" + byte[] out = null; + String in = (String)source(); + out = Base64Utils.decodeFromString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;decodeFromUrlSafeString;;;Argument[0];ReturnValue;taint" + byte[] out = null; + String in = (String)source(); + out = Base64Utils.decodeFromUrlSafeString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;decodeUrlSafe;;;Argument[0];ReturnValue;taint" + byte[] out = null; + byte[] in = (byte[])source(); + out = Base64Utils.decodeUrlSafe(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;encode;;;Argument[0];ReturnValue;taint" + byte[] out = null; + byte[] in = (byte[])source(); + out = Base64Utils.encode(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;encodeToString;;;Argument[0];ReturnValue;taint" + String out = null; + byte[] in = (byte[])source(); + out = Base64Utils.encodeToString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;encodeToUrlSafeString;;;Argument[0];ReturnValue;taint" + String out = null; + byte[] in = (byte[])source(); + out = Base64Utils.encodeToUrlSafeString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;Base64Utils;false;encodeUrlSafe;;;Argument[0];ReturnValue;taint" + byte[] out = null; + byte[] in = (byte[])source(); + out = Base64Utils.encodeUrlSafe(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;CollectionUtils;false;arrayToList;;;ArrayElement of Argument[0];Element of ReturnValue;value" + List out = null; + Object[] in = newWithArrayElement(source()); + out = CollectionUtils.arrayToList(in); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;findFirstMatch;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Collection in = List.of(source()); + out = CollectionUtils.findFirstMatch(in, null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;findValueOfType;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Collection in = List.of(source()); + out = CollectionUtils.findValueOfType(in, (Class[])null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;findValueOfType;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Collection in = List.of(source()); + out = CollectionUtils.findValueOfType(in, (Class)null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;firstElement;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Set in = Set.of(source()); + out = CollectionUtils.firstElement(in); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;firstElement;;;Element of Argument[0];ReturnValue;value" + Object out = null; + List in = List.of(source()); + out = CollectionUtils.firstElement(in); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;lastElement;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Set in = Set.of(source()); + out = CollectionUtils.lastElement(in); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;lastElement;;;Element of Argument[0];ReturnValue;value" + Object out = null; + List in = List.of(source()); + out = CollectionUtils.lastElement(in); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;mergeArrayIntoCollection;;;ArrayElement of Argument[0];Element of Argument[1];value" + Collection out = null; + Object[] in = newWithArrayElement(source()); + CollectionUtils.mergeArrayIntoCollection(in, out); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;mergePropertiesIntoMap;;;MapKey of Argument[0];MapKey of Argument[1];value" + Map out = null; + Properties in = newPropertiesWithMapKey(source()); + CollectionUtils.mergePropertiesIntoMap(in, out); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;mergePropertiesIntoMap;;;MapValue of Argument[0];MapValue of Argument[1];value" + Map out = null; + Properties in = newPropertiesWithMapValue(source()); + CollectionUtils.mergePropertiesIntoMap(in, out); + sink(getMapValue(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;toIterator;;;Element of Argument[0];Element of ReturnValue;value" + Iterator out = null; + Enumeration in = Collections.enumeration(List.of(source())); + out = CollectionUtils.toIterator(in); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;toMultiValueMap;;;Element of MapValue of Argument[0];Element of MapValue of ReturnValue;value" + MultiValueMap out = null; + Map in = Map.of(null, List.of(source())); + out = CollectionUtils.toMultiValueMap(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;toMultiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value" + MultiValueMap out = null; + Map in = Map.of(source(), null); + out = CollectionUtils.toMultiValueMap(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;unmodifiableMultiValueMap;;;MapKey of Argument[0];MapKey of ReturnValue;value" + MultiValueMap out = null; + MultiValueMap in = new LinkedMultiValueMap(Map.of(source(), null)); + out = CollectionUtils.unmodifiableMultiValueMap(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;CollectionUtils;false;unmodifiableMultiValueMap;;;MapValue of Argument[0];MapValue of ReturnValue;value" + MultiValueMap out = null; + MultiValueMap in = new LinkedMultiValueMap(); + in.put(null, source()); + out = CollectionUtils.unmodifiableMultiValueMap(in); + sink(getMapValue(out)); // $hasValueFlow + } + { + // "org.springframework.util;CompositeIterator;false;add;;;Element of Argument[0];Element of Argument[-1];value" + CompositeIterator out = null; + Iterator in = List.of(source()).iterator(); + out.add(in); + sink(getElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;CompositeIterator;false;next;;;Element of Argument[-1];ReturnValue;value" + Object out = null; + CompositeIterator in = new CompositeIterator(); + in.add(List.of(source()).iterator()); + out = in.next(); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;FastByteArrayOutputStream;false;getInputStream;;;Argument[-1];ReturnValue;taint" + InputStream out = null; + FastByteArrayOutputStream in = (FastByteArrayOutputStream)source(); + out = in.getInputStream(); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FastByteArrayOutputStream;false;toByteArray;;;Argument[-1];ReturnValue;taint" + byte[] out = null; + FastByteArrayOutputStream in = (FastByteArrayOutputStream)source(); + out = in.toByteArray(); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FastByteArrayOutputStream;false;write;;;Argument[0];Argument[-1];taint" + FastByteArrayOutputStream out = null; + int in = (int)source(); + out.write(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FastByteArrayOutputStream;false;write;;;Argument[0];Argument[-1];taint" + FastByteArrayOutputStream out = null; + byte[] in = (byte[])source(); + out.write(in, 0, 0); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FastByteArrayOutputStream;false;writeTo;;;Argument[-1];Argument[0];taint" + OutputStream out = null; + FastByteArrayOutputStream in = (FastByteArrayOutputStream)source(); + in.writeTo(out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + Writer out = null; + String in = (String)source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + Writer out = null; + Reader in = (Reader)source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + OutputStream out = null; + byte[] in = (byte[])source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + OutputStream out = null; + InputStream in = (InputStream)source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + File out = null; + byte[] in = (byte[])source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copy;;;Argument[0];Argument[1];taint" + File out = null; + File in = (File)source(); + FileCopyUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copyToByteArray;;;Argument[0];ReturnValue;taint" + byte[] out = null; + InputStream in = (InputStream)source(); + out = FileCopyUtils.copyToByteArray(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copyToByteArray;;;Argument[0];ReturnValue;taint" + byte[] out = null; + File in = (File)source(); + out = FileCopyUtils.copyToByteArray(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileCopyUtils;false;copyToString;;;Argument[0];ReturnValue;taint" + String out = null; + Reader in = (Reader)source(); + out = FileCopyUtils.copyToString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;FileSystemUtils;false;copyRecursively;(java.io.File,java.io.File);;Argument[0];Argument[1];taint" + File out = null; + File in = (File)source(); + FileSystemUtils.copyRecursively(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;LinkedMultiValueMap;false;LinkedMultiValueMap;(java.util.Map);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value" + LinkedMultiValueMap out = null; + Map in = Map.of(null, List.of(source())); + out = new LinkedMultiValueMap(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;LinkedMultiValueMap;false;LinkedMultiValueMap;(java.util.Map);;MapKey of Argument[0];MapKey of Argument[-1];value" + LinkedMultiValueMap out = null; + Map in = Map.of(source(), null); + out = new LinkedMultiValueMap(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;LinkedMultiValueMap;false;deepCopy;;;MapKey of Argument[-1];MapValue of ReturnValue;value" + LinkedMultiValueMap out = null; + LinkedMultiValueMap in = new LinkedMultiValueMap(); + in.set(source(), null); + out = in.deepCopy(); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;LinkedMultiValueMap;false;deepCopy;;;MapValue of Argument[-1];MapValue of ReturnValue;value" + LinkedMultiValueMap out = null; + LinkedMultiValueMap in = new LinkedMultiValueMap(); + in.set(null, source()); + out = in.deepCopy(); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + Object in = source(); + out.add(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.add(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.add(in, (Object)null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + Object in = source(); + out.add(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.add(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;add;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.add((Object)null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Element of Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + List in = List.of(source()); + out.addAll(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Element of Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + List in = List.of(source()); + out.addAll(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Element of Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + List in = List.of(source()); + out.addAll((Object)null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + MultiValueMap in = (MultiValueMap)Map.of(null, List.of(source())); + out.addAll(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + MultiValueMap in = (MultiValueMap)Map.of(null, List.of(source())); + out.addAll(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + Object in = source(); + out.addAll(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.addAll(in, (List)null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + MultiValueMap mvm = null; + mvm.set(source(), "someValue"); + out.addAll(mvm); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + MultiValueMap mvm = null; + mvm.set(source(), "someValue"); + out.addAll(mvm); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.addIfAbsent(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.addIfAbsent(in, (Object)null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.addIfAbsent(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.addIfAbsent((Object)null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;getFirst;;;Element of MapValue of Argument[-1];ReturnValue;value" + Object out = null; + MultiValueMapAdapter in = new MultiValueMapAdapter(Map.of(null, List.of(source()))); + out = in.getFirst(null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;getFirst;;;Element of MapValue of Argument[-1];ReturnValue;value" + Object out = null; + MultiValueMap in = (MultiValueMap)Map.of(null, List.of(source())); + out = in.getFirst(null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;getFirst;;;Element of MapValue of Argument[-1];ReturnValue;value" + Object out = null; + MultiValueMap in = (MultiValueMap)Map.of(null, List.of(source())); + out = in.getFirst((Object)null); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;set;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + Object in = source(); + out.set(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;set;;;Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.set(in, null); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;set;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + Object in = source(); + out.set(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;set;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.set(null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;set;;;Argument[1];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Object in = source(); + out.set((Object)null, in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;setAll;;;MapKey of Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + Map in = Map.of(source(), null); + out.setAll(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;setAll;;;MapKey of Argument[0];MapKey of Argument[-1];value" + MultiValueMap out = null; + Map in = Map.of(source(), null); + out.setAll(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;setAll;;;MapValue of Argument[0];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + Map in = Map.of(null, source()); + out.setAll(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;setAll;;;MapValue of Argument[0];Element of MapValue of Argument[-1];value" + MultiValueMap out = null; + Map in = Map.of(null, source()); + out.setAll(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;Element of MapValue of Argument[-1];MapValue of ReturnValue;value" + Map out = null; + MultiValueMapAdapter in = new MultiValueMapAdapter(Map.of(null, List.of(source()))); + out = in.toSingleValueMap(); + sink(getMapValue(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;Element of MapValue of Argument[-1];MapValue of ReturnValue;value" + Map out = null; + MultiValueMap in = (MultiValueMap)Map.of(null, List.of(source())); + out = in.toSingleValueMap(); + sink(getMapValue(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;MapKey of Argument[-1];MapKey of ReturnValue;value" + Map out = null; + MultiValueMapAdapter in = new MultiValueMapAdapter(Map.of(source(), null)); + out = in.toSingleValueMap(); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMap;true;toSingleValueMap;;;MapKey of Argument[-1];MapKey of ReturnValue;value" + Map out = null; + MultiValueMap in = new MultiValueMapAdapter(Map.of(source(), null)); + out = in.toSingleValueMap(); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMapAdapter;false;MultiValueMapAdapter;;;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value" + MultiValueMapAdapter out = null; + Map in = Map.of(null, List.of(source())); + out = new MultiValueMapAdapter(in); + sink(getElement(getMapValue(out))); // $hasValueFlow + } + { + // "org.springframework.util;MultiValueMapAdapter;false;MultiValueMapAdapter;;;MapKey of Argument[0];MapKey of Argument[-1];value" + MultiValueMapAdapter out = null; + Map in = Map.of(source(), null); + out = new MultiValueMapAdapter(in); + sink(getMapKey(out)); // $hasValueFlow + } + { + // "org.springframework.util;ObjectUtils;false;toObjectArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value" + Object[] out = null; + Object[] in = newWithArrayElement(source()); + out = ObjectUtils.toObjectArray(in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;ObjectUtils;false;unwrapOptional;;;Element of Argument[0];ReturnValue;value" + Object out = null; + Object in = Optional.of(source()); + out = ObjectUtils.unwrapOptional(in); + sink(out); // $hasValueFlow + } + { + // "org.springframework.util;PropertiesPersister;true;load;;;Argument[1];Argument[0];taint" + Properties out = null; + Reader in = (Reader)source(); + PropertiesPersister instance = null; + instance.load(out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;load;;;Argument[1];Argument[0];taint" + Properties out = null; + InputStream in = (InputStream)source(); + PropertiesPersister instance = null; + instance.load(out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;loadFromXml;;;Argument[1];Argument[0];taint" + Properties out = null; + InputStream in = (InputStream)source(); + PropertiesPersister instance = null; + instance.loadFromXml(out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;store;;;Argument[0];Argument[1];taint" + Writer out = null; + Properties in = (Properties)source(); + PropertiesPersister instance = null; + instance.store(in, out, (String)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;store;;;Argument[0];Argument[1];taint" + OutputStream out = null; + Properties in = (Properties)source(); + PropertiesPersister instance = null; + instance.store(in, out, (String)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;store;;;Argument[2];Argument[1];taint" + Writer out = null; + String in = (String)source(); + PropertiesPersister instance = null; + instance.store((Properties)null, out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;store;;;Argument[2];Argument[1];taint" + OutputStream out = null; + String in = (String)source(); + PropertiesPersister instance = null; + instance.store((Properties)null, out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[0];Argument[1];taint" + OutputStream out = null; + Properties in = (Properties)source(); + PropertiesPersister instance = null; + instance.storeToXml(in, out, null, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[0];Argument[1];taint" + OutputStream out = null; + Properties in = (Properties)source(); + PropertiesPersister instance = null; + instance.storeToXml(in, out, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[2];Argument[1];taint" + OutputStream out = null; + String in = (String)source(); + PropertiesPersister instance = null; + instance.storeToXml(null, out, in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertiesPersister;true;storeToXml;;;Argument[2];Argument[1];taint" + OutputStream out = null; + String in = (String)source(); + PropertiesPersister instance = null; + instance.storeToXml(null, out, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;PropertyPlaceholderHelper;;;Argument[0..1];Argument[-1];taint" + PropertyPlaceholderHelper out = null; + String in = (String)source(); + out = new PropertyPlaceholderHelper(null, in, null, false); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;PropertyPlaceholderHelper;;;Argument[0..1];Argument[-1];taint" + PropertyPlaceholderHelper out = null; + String in = (String)source(); + out = new PropertyPlaceholderHelper(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;PropertyPlaceholderHelper;;;Argument[0..1];Argument[-1];taint" + PropertyPlaceholderHelper out = null; + String in = (String)source(); + out = new PropertyPlaceholderHelper(in, null, null, false); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;PropertyPlaceholderHelper;;;Argument[0..1];Argument[-1];taint" + PropertyPlaceholderHelper out = null; + String in = (String)source(); + out = new PropertyPlaceholderHelper(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;replacePlaceholders;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + PropertyPlaceholderHelper instance = null; + out = instance.replacePlaceholders(in, (PropertyPlaceholderHelper.PlaceholderResolver)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;PropertyPlaceholderHelper;false;replacePlaceholders;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + PropertyPlaceholderHelper instance = null; + out = instance.replacePlaceholders(in, (Properties)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;extractArchiveURL;;;Argument[0];ReturnValue;taint" + URL out = null; + URL in = (URL)source(); + out = ResourceUtils.extractArchiveURL(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;extractJarFileURL;;;Argument[0];ReturnValue;taint" + URL out = null; + URL in = (URL)source(); + out = ResourceUtils.extractJarFileURL(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint" + File out = null; + URL in = (URL)source(); + out = ResourceUtils.getFile(in, (String)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint" + File out = null; + URL in = (URL)source(); + out = ResourceUtils.getFile(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint" + File out = null; + URI in = (URI)source(); + out = ResourceUtils.getFile(in, (String)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint" + File out = null; + URI in = (URI)source(); + out = ResourceUtils.getFile(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getFile;;;Argument[0];ReturnValue;taint" + File out = null; + String in = (String)source(); + out = ResourceUtils.getFile(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;getURL;;;Argument[0];ReturnValue;taint" + URL out = null; + String in = (String)source(); + out = ResourceUtils.getURL(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;toURI;;;Argument[0];ReturnValue;taint" + URI out = null; + URL in = (URL)source(); + out = ResourceUtils.toURI(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;ResourceUtils;false;toURI;;;Argument[0];ReturnValue;taint" + URI out = null; + String in = (String)source(); + out = ResourceUtils.toURI(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;RouteMatcher;true;combine;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + RouteMatcher instance = null; + out = instance.combine(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;RouteMatcher;true;combine;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + RouteMatcher instance = null; + out = instance.combine(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;RouteMatcher;true;matchAndExtract;;;Argument[0];MapKey of ReturnValue;taint" + Map out = null; + String in = (String)source(); + RouteMatcher instance = null; + out = instance.matchAndExtract(in, null); + sink(getMapKey(out)); // $hasTaintFlow + } + { + // "org.springframework.util;RouteMatcher;true;matchAndExtract;;;Argument[1];MapValue of ReturnValue;taint" + Map out = null; + RouteMatcher.Route in = (RouteMatcher.Route)source(); + RouteMatcher instance = null; + out = instance.matchAndExtract(null, in); + sink(getMapValue(out)); // $hasTaintFlow + } + { + // "org.springframework.util;RouteMatcher;true;parseRoute;;;Argument[0];ReturnValue;taint" + RouteMatcher.Route out = null; + String in = (String)source(); + RouteMatcher instance = null; + out = instance.parseRoute(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;SerializationUtils;false;deserialize;;;Argument[0];ReturnValue;taint" + Object out = null; + byte[] in = (byte[])source(); + out = SerializationUtils.deserialize(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;SerializationUtils;false;serialize;;;Argument[0];ReturnValue;taint" + byte[] out = null; + Object in = source(); + out = SerializationUtils.serialize(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copy;(byte[],java.io.OutputStream);;Argument[0];Argument[1];taint" + OutputStream out = null; + byte[] in = (byte[])source(); + StreamUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copy;(java.io.InputStream,java.io.OutputStream);;Argument[0];Argument[1];taint" + OutputStream out = null; + InputStream in = (InputStream)source(); + StreamUtils.copy(in, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copy;(java.lang.String,java.nio.charset.Charset,java.io.OutputStream);;Argument[0];Argument[2];taint" + OutputStream out = null; + String in = (String)source(); + StreamUtils.copy(in, null, out); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copyRange;;;Argument[0];Argument[1];taint" + OutputStream out = null; + InputStream in = (InputStream)source(); + StreamUtils.copyRange(in, out, 0L, 0L); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copyToByteArray;;;Argument[0];ReturnValue;taint" + byte[] out = null; + InputStream in = (InputStream)source(); + out = StreamUtils.copyToByteArray(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copyToString;;;Argument[0];ReturnValue;taint" + String out = null; + InputStream in = (InputStream)source(); + out = StreamUtils.copyToString(in, (Charset)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StreamUtils;false;copyToString;;;Argument[0];ReturnValue;taint" + String out = null; + ByteArrayOutputStream in = (ByteArrayOutputStream)source(); + out = StreamUtils.copyToString(in, (Charset)null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;addStringToArray;;;Argument[1];ArrayElement of ReturnValue;value" + String[] out = null; + String in = (String)source(); + out = StringUtils.addStringToArray(null, in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;addStringToArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value" + String[] out = null; + String[] in = (String[])newWithArrayElement(source()); + out = StringUtils.addStringToArray(in, null); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;applyRelativePath;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.applyRelativePath(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;applyRelativePath;;;Argument[0..1];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.applyRelativePath(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;arrayToCommaDelimitedString;;;ArrayElement of Argument[0];ReturnValue;taint", + String out = null; + Object[] in = { source() }; + out = StringUtils.arrayToCommaDelimitedString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;arrayToDelimitedString;;;Argument[1];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.arrayToDelimitedString(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;arrayToDelimitedString;;;ArrayElement of Argument[0];ReturnValue;taint", + String out = null; + Object[] in = { source() }; + out = StringUtils.arrayToDelimitedString(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;capitalize;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.capitalize(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;cleanPath;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.cleanPath(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToCommaDelimitedString;;;Element of Argument[0];ReturnValue;taint" + String out = null; + Collection in = List.of(source()); + out = StringUtils.collectionToCommaDelimitedString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Argument[1..3];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.collectionToDelimitedString(null, null, null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Argument[1..3];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.collectionToDelimitedString(null, null, in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Argument[1..3];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.collectionToDelimitedString(null, in, null, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Argument[1..3];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.collectionToDelimitedString(null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Element of Argument[0];ReturnValue;taint" + String out = null; + Collection in = List.of(source()); + out = StringUtils.collectionToDelimitedString(in, null, null, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;collectionToDelimitedString;;;Element of Argument[0];ReturnValue;taint" + String out = null; + Collection in = List.of(source()); + out = StringUtils.collectionToDelimitedString(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;commaDelimitedListToSet;;;Argument[0];Element of ReturnValue;taint" + Set out = null; + String in = (String)source(); + out = StringUtils.commaDelimitedListToSet(in); + sink(getElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;commaDelimitedListToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.commaDelimitedListToStringArray(in); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;concatenateStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;taint" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.concatenateStringArrays(null, in); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;concatenateStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;taint" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.concatenateStringArrays(in, null); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;delete;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.delete(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;deleteAny;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.deleteAny(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;delimitedListToStringArray;;;Argument[0];ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.delimitedListToStringArray(in, null, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;delimitedListToStringArray;;;Argument[0];ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.delimitedListToStringArray(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;getFilename;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.getFilename(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;getFilenameExtension;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.getFilenameExtension(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;mergeStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;value" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.mergeStringArrays(null, in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;mergeStringArrays;;;ArrayElement of Argument[0..1];ArrayElement of ReturnValue;value" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.mergeStringArrays(in, null); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;quote;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.quote(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;quoteIfString;;;Argument[0];ReturnValue;taint" + Object out = null; + Object in = source(); + out = StringUtils.quoteIfString(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;removeDuplicateStrings;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.removeDuplicateStrings(in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;replace;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.replace(in, null, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;replace;;;Argument[2];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.replace(null, null, in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;sortStringArray;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;value" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.sortStringArray(in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;split;;;Argument[0];ArrayElement of ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.split(in, null); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;splitArrayElementsIntoProperties;;;ArrayElement of Argument[0];MapKey of ReturnValue;taint", + Properties out = null; + String[] in = { (String)source() }; + out = StringUtils.splitArrayElementsIntoProperties(in, null, null); + sink(getMapKey(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;splitArrayElementsIntoProperties;;;ArrayElement of Argument[0];MapValue of ReturnValue;taint", + Properties out = null; + String[] in = { (String)source() }; + out = StringUtils.splitArrayElementsIntoProperties(in, null, null); + sink(getMapValue(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;splitArrayElementsIntoProperties;;;Argument[0];ReturnValue;taint" + Properties out = null; + String[] in = (String[])source(); + out = StringUtils.splitArrayElementsIntoProperties(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;stripFilenameExtension;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.stripFilenameExtension(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;toStringArray;;;Element of Argument[0];ArrayElement of ReturnValue;value", + String[] out = null; + Enumeration in = Collections.enumeration(List.of(source()));; + out = StringUtils.toStringArray(in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;toStringArray;;;Element of Argument[0];ArrayElement of ReturnValue;value", + String[] out = null; + Collection in = List.of(source()); + out = StringUtils.toStringArray(in); + sink(getArrayElement(out)); // $hasValueFlow + } + { + // "org.springframework.util;StringUtils;false;tokenizeToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.tokenizeToStringArray(in, null, false, false); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;tokenizeToStringArray;;;Argument[0];ArrayElement of ReturnValue;taint" + String[] out = null; + String in = (String)source(); + out = StringUtils.tokenizeToStringArray(in, null); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimAllWhitespace;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimAllWhitespace(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimArrayElements;;;ArrayElement of Argument[0];ArrayElement of ReturnValue;taint" + String[] out = null; + String[] in = { (String)source() }; + out = StringUtils.trimArrayElements(in); + sink(getArrayElement(out)); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimLeadingCharacter;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimLeadingCharacter(in, 'a'); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimLeadingWhitespace;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimLeadingWhitespace(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimTrailingCharacter;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimTrailingCharacter(in, 'a'); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimTrailingWhitespace;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimTrailingWhitespace(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;trimWhitespace;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.trimWhitespace(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;uncapitalize;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.uncapitalize(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;unqualify;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.unqualify(in, 'a'); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;unqualify;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.unqualify(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringUtils;false;uriDecode;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = StringUtils.uriDecode(in, null); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;StringValueResolver;false;resolveStringValue;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + StringValueResolver instance = null; + out = instance.resolveStringValue(in); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;SystemPropertyUtils;false;resolvePlaceholders;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = SystemPropertyUtils.resolvePlaceholders(in, false); + sink(out); // $hasTaintFlow + } + { + // "org.springframework.util;SystemPropertyUtils;false;resolvePlaceholders;;;Argument[0];ReturnValue;taint" + String out = null; + String in = (String)source(); + out = SystemPropertyUtils.resolvePlaceholders(in); + sink(out); // $hasTaintFlow + } + + } + +} diff --git a/java/ql/test/library-tests/frameworks/spring/util/options b/java/ql/test/library-tests/frameworks/spring/util/options new file mode 100644 index 00000000000..06ec85dc706 --- /dev/null +++ b/java/ql/test/library-tests/frameworks/spring/util/options @@ -0,0 +1 @@ +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/springframework-5.3.8 diff --git a/java/ql/test/library-tests/frameworks/spring/util/test.expected b/java/ql/test/library-tests/frameworks/spring/util/test.expected new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/ql/test/library-tests/frameworks/spring/util/test.ql b/java/ql/test/library-tests/frameworks/spring/util/test.ql new file mode 100644 index 00000000000..6158159e1e5 --- /dev/null +++ b/java/ql/test/library-tests/frameworks/spring/util/test.ql @@ -0,0 +1,52 @@ +import java +import semmle.code.java.dataflow.DataFlow +import semmle.code.java.dataflow.TaintTracking +import TestUtilities.InlineExpectationsTest + +class ValueFlowConf extends DataFlow::Configuration { + ValueFlowConf() { this = "qltest:valueFlowConf" } + + override predicate isSource(DataFlow::Node n) { + n.asExpr().(MethodAccess).getMethod().hasName("source") + } + + override predicate isSink(DataFlow::Node n) { + n.asExpr().(Argument).getCall().getCallee().hasName("sink") + } +} + +class TaintFlowConf extends TaintTracking::Configuration { + TaintFlowConf() { this = "qltest:taintFlowConf" } + + override predicate isSource(DataFlow::Node n) { + n.asExpr().(MethodAccess).getMethod().hasName("source") + } + + override predicate isSink(DataFlow::Node n) { + n.asExpr().(Argument).getCall().getCallee().hasName("sink") + } +} + +class HasFlowTest extends InlineExpectationsTest { + HasFlowTest() { this = "HasFlowTest" } + + override string getARelevantTag() { result = ["hasValueFlow", "hasTaintFlow"] } + + override predicate hasActualResult(Location location, string element, string tag, string value) { + tag = "hasValueFlow" and + exists(DataFlow::Node src, DataFlow::Node sink, ValueFlowConf conf | conf.hasFlow(src, sink) | + sink.getLocation() = location and + element = sink.toString() and + value = "" + ) + or + tag = "hasTaintFlow" and + exists(DataFlow::Node src, DataFlow::Node sink, TaintFlowConf conf | + conf.hasFlow(src, sink) and not any(ValueFlowConf c).hasFlow(src, sink) + | + sink.getLocation() = location and + element = sink.toString() and + value = "" + ) + } +} diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/JaxXSS.java b/java/ql/test/query-tests/security/CWE-079/semmle/tests/JaxXSS.java new file mode 100644 index 00000000000..62f99bbdab0 --- /dev/null +++ b/java/ql/test/query-tests/security/CWE-079/semmle/tests/JaxXSS.java @@ -0,0 +1,247 @@ +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Variant; + +import java.util.Locale; + +@Path("") +public class JaxXSS { + + @GET + public static Response specificContentType(boolean safeContentType, boolean chainDirectly, boolean contentTypeFirst, String userControlled) { + + Response.ResponseBuilder builder = Response.ok(); + + if(!safeContentType) { + if(chainDirectly) { + if(contentTypeFirst) + return builder.type(MediaType.TEXT_HTML).entity(userControlled).build(); // $xss + else + return builder.entity(userControlled).type(MediaType.TEXT_HTML).build(); // $xss + } + else { + if(contentTypeFirst) { + Response.ResponseBuilder builder2 = builder.type(MediaType.TEXT_HTML); + return builder2.entity(userControlled).build(); // $xss + } + else { + Response.ResponseBuilder builder2 = builder.entity(userControlled); + return builder2.type(MediaType.TEXT_HTML).build(); // $xss + } + } + } + else { + if(chainDirectly) { + if(contentTypeFirst) + return builder.type(MediaType.APPLICATION_JSON).entity(userControlled).build(); // $SPURIOUS: xss + else + return builder.entity(userControlled).type(MediaType.APPLICATION_JSON).build(); // $SPURIOUS: xss + } + else { + if(contentTypeFirst) { + Response.ResponseBuilder builder2 = builder.type(MediaType.APPLICATION_JSON); + return builder2.entity(userControlled).build(); // $SPURIOUS: xss + } + else { + Response.ResponseBuilder builder2 = builder.entity(userControlled); + return builder2.type(MediaType.APPLICATION_JSON).build(); // $SPURIOUS: xss + } + } + } + + } + + @GET + public static Response specificContentTypeSetterMethods(int route, boolean safeContentType, String userControlled) { + + // Test the remarkably many routes to setting a content-type in Jax-RS, besides the ResponseBuilder.entity method used above: + + if(safeContentType) { + if(route == 0) { + // via ok, as a string literal: + return Response.ok(userControlled, "application/json").build(); // $SPURIOUS: xss + } + else if(route == 1) { + // via ok, as a string constant: + return Response.ok(userControlled, MediaType.APPLICATION_JSON).build(); // $SPURIOUS: xss + } + else if(route == 2) { + // via ok, as a MediaType constant: + return Response.ok(userControlled, MediaType.APPLICATION_JSON_TYPE).build(); // $SPURIOUS: xss + } + else if(route == 3) { + // via ok, as a Variant, via constructor: + return Response.ok(userControlled, new Variant(MediaType.APPLICATION_JSON_TYPE, "language", "encoding")).build(); // $SPURIOUS: xss + } + else if(route == 4) { + // via ok, as a Variant, via static method: + return Response.ok(userControlled, Variant.mediaTypes(MediaType.APPLICATION_JSON_TYPE).build().get(0)).build(); // $SPURIOUS: xss + } + else if(route == 5) { + // via ok, as a Variant, via instance method: + return Response.ok(userControlled, Variant.languages(Locale.UK).mediaTypes(MediaType.APPLICATION_JSON_TYPE).build().get(0)).build(); // $SPURIOUS: xss + } + else if(route == 6) { + // via builder variant, before entity: + return Response.ok().variant(new Variant(MediaType.APPLICATION_JSON_TYPE, "language", "encoding")).entity(userControlled).build(); // $SPURIOUS: xss + } + else if(route == 7) { + // via builder variant, after entity: + return Response.ok().entity(userControlled).variant(new Variant(MediaType.APPLICATION_JSON_TYPE, "language", "encoding")).build(); // $SPURIOUS: xss + } + else if(route == 8) { + // provide entity via ok, then content-type via builder: + return Response.ok(userControlled).type(MediaType.APPLICATION_JSON_TYPE).build(); // $SPURIOUS: xss + } + } + else { + if(route == 0) { + // via ok, as a string literal: + return Response.ok("text/html").entity(userControlled).build(); // $xss + } + else if(route == 1) { + // via ok, as a string constant: + return Response.ok(MediaType.TEXT_HTML).entity(userControlled).build(); // $xss + } + else if(route == 2) { + // via ok, as a MediaType constant: + return Response.ok(MediaType.TEXT_HTML_TYPE).entity(userControlled).build(); // $xss + } + else if(route == 3) { + // via ok, as a Variant, via constructor: + return Response.ok(new Variant(MediaType.TEXT_HTML_TYPE, "language", "encoding")).entity(userControlled).build(); // $xss + } + else if(route == 4) { + // via ok, as a Variant, via static method: + return Response.ok(Variant.mediaTypes(MediaType.TEXT_HTML_TYPE).build()).entity(userControlled).build(); // $xss + } + else if(route == 5) { + // via ok, as a Variant, via instance method: + return Response.ok(Variant.languages(Locale.UK).mediaTypes(MediaType.TEXT_HTML_TYPE).build()).entity(userControlled).build(); // $xss + } + else if(route == 6) { + // via builder variant, before entity: + return Response.ok().variant(new Variant(MediaType.TEXT_HTML_TYPE, "language", "encoding")).entity(userControlled).build(); // $xss + } + else if(route == 7) { + // via builder variant, after entity: + return Response.ok().entity(userControlled).variant(new Variant(MediaType.TEXT_HTML_TYPE, "language", "encoding")).build(); // $xss + } + else if(route == 8) { + // provide entity via ok, then content-type via builder: + return Response.ok(userControlled).type(MediaType.TEXT_HTML_TYPE).build(); // $xss + } + } + + return null; + + } + + @GET @Produces(MediaType.APPLICATION_JSON) + public static Response methodContentTypeSafe(String userControlled) { + return Response.ok(userControlled).build(); + } + + @POST @Produces(MediaType.APPLICATION_JSON) + public static Response methodContentTypeSafePost(String userControlled) { + return Response.ok(userControlled).build(); + } + + @GET @Produces("application/json") + public static Response methodContentTypeSafeStringLiteral(String userControlled) { + return Response.ok(userControlled).build(); + } + + @GET @Produces(MediaType.TEXT_HTML) + public static Response methodContentTypeUnsafe(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @POST @Produces(MediaType.TEXT_HTML) + public static Response methodContentTypeUnsafePost(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @GET @Produces("text/html") + public static Response methodContentTypeUnsafeStringLiteral(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @GET @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON}) + public static Response methodContentTypeMaybeSafe(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @GET @Produces(MediaType.APPLICATION_JSON) + public static Response methodContentTypeSafeOverriddenWithUnsafe(String userControlled) { + return Response.ok().type(MediaType.TEXT_HTML).entity(userControlled).build(); // $MISSING: xss + } + + @GET @Produces(MediaType.TEXT_HTML) + public static Response methodContentTypeUnsafeOverriddenWithSafe(String userControlled) { + return Response.ok().type(MediaType.APPLICATION_JSON).entity(userControlled).build(); + } + + @Path("/abc") + @Produces({"application/json"}) + public static class ClassContentTypeSafe { + @GET + public Response test(String userControlled) { + return Response.ok(userControlled).build(); + } + + @GET + public String testDirectReturn(String userControlled) { + return userControlled; + } + + @GET @Produces({"text/html"}) + public Response overridesWithUnsafe(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @GET + public Response overridesWithUnsafe2(String userControlled) { + return Response.ok().type(MediaType.TEXT_HTML).entity(userControlled).build(); // $MISSING: xss + } + } + + @Path("/abc") + @Produces({"text/html"}) + public static class ClassContentTypeUnsafe { + @GET + public Response test(String userControlled) { + return Response.ok(userControlled).build(); // $MISSING: xss + } + + @GET + public String testDirectReturn(String userControlled) { + return userControlled; // $MISSING: xss + } + + @GET @Produces({"application/json"}) + public Response overridesWithSafe(String userControlled) { + return Response.ok(userControlled).build(); + } + + @GET + public Response overridesWithSafe2(String userControlled) { + return Response.ok().type(MediaType.APPLICATION_JSON).entity(userControlled).build(); + } + } + + @GET + public static Response entityWithNoMediaType(String userControlled) { + return Response.ok(userControlled).build(); // $xss + } + + @GET + public static String stringWithNoMediaType(String userControlled) { + return userControlled; // $xss + } + +} \ No newline at end of file diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.expected b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.expected index c800f627c64..e69de29bb2d 100644 --- a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.expected +++ b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.expected @@ -1,15 +0,0 @@ -edges -| XSS.java:23:21:23:48 | getParameter(...) : String | XSS.java:23:5:23:70 | ... + ... | -| XSS.java:38:67:38:87 | getPathInfo(...) : String | XSS.java:38:30:38:87 | ... + ... | -| XSS.java:41:36:41:56 | getPathInfo(...) : String | XSS.java:41:36:41:67 | getBytes(...) | -nodes -| XSS.java:23:5:23:70 | ... + ... | semmle.label | ... + ... | -| XSS.java:23:21:23:48 | getParameter(...) : String | semmle.label | getParameter(...) : String | -| XSS.java:38:30:38:87 | ... + ... | semmle.label | ... + ... | -| XSS.java:38:67:38:87 | getPathInfo(...) : String | semmle.label | getPathInfo(...) : String | -| XSS.java:41:36:41:56 | getPathInfo(...) : String | semmle.label | getPathInfo(...) : String | -| XSS.java:41:36:41:67 | getBytes(...) | semmle.label | getBytes(...) | -#select -| XSS.java:23:5:23:70 | ... + ... | XSS.java:23:21:23:48 | getParameter(...) : String | XSS.java:23:5:23:70 | ... + ... | Cross-site scripting vulnerability due to $@. | XSS.java:23:21:23:48 | getParameter(...) | user-provided value | -| XSS.java:38:30:38:87 | ... + ... | XSS.java:38:67:38:87 | getPathInfo(...) : String | XSS.java:38:30:38:87 | ... + ... | Cross-site scripting vulnerability due to $@. | XSS.java:38:67:38:87 | getPathInfo(...) | user-provided value | -| XSS.java:41:36:41:67 | getBytes(...) | XSS.java:41:36:41:56 | getPathInfo(...) : String | XSS.java:41:36:41:67 | getBytes(...) | Cross-site scripting vulnerability due to $@. | XSS.java:41:36:41:56 | getPathInfo(...) | user-provided value | diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.java b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.java index 3ebaac47819..2854ffe30b7 100644 --- a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.java +++ b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.java @@ -20,7 +20,7 @@ public class XSS extends HttpServlet { throws ServletException, IOException { // BAD: a request parameter is written directly to the Servlet response stream response.getWriter().print( - "The page \"" + request.getParameter("page") + "\" was not found."); + "The page \"" + request.getParameter("page") + "\" was not found."); // $xss // GOOD: servlet API encodes the error message HTML for the HTML context response.sendError(HttpServletResponse.SC_NOT_FOUND, @@ -35,10 +35,10 @@ public class XSS extends HttpServlet { "The page \"" + capitalizeName(request.getParameter("page")) + "\" was not found."); // BAD: outputting the path of the resource - response.getWriter().print("The path section of the URL was " + request.getPathInfo()); + response.getWriter().print("The path section of the URL was " + request.getPathInfo()); // $xss // BAD: typical XSS, this time written to an OutputStream instead of a Writer - response.getOutputStream().write(request.getPathInfo().getBytes()); + response.getOutputStream().write(request.getPathInfo().getBytes()); // $xss } diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.ql b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.ql new file mode 100644 index 00000000000..1cd3e59fc6b --- /dev/null +++ b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.ql @@ -0,0 +1,33 @@ +import java +import semmle.code.java.dataflow.FlowSources +import semmle.code.java.security.XSS +import TestUtilities.InlineExpectationsTest + +class XSSConfig extends TaintTracking::Configuration { + XSSConfig() { this = "XSSConfig" } + + override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource } + + override predicate isSink(DataFlow::Node sink) { sink instanceof XssSink } + + override predicate isSanitizer(DataFlow::Node node) { node instanceof XssSanitizer } + + override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) { + any(XssAdditionalTaintStep s).step(node1, node2) + } +} + +class XssTest extends InlineExpectationsTest { + XssTest() { this = "XssTest" } + + override string getARelevantTag() { result = ["xss"] } + + override predicate hasActualResult(Location location, string element, string tag, string value) { + tag = "xss" and + exists(DataFlow::Node src, DataFlow::Node sink, XSSConfig conf | conf.hasFlow(src, sink) | + sink.getLocation() = location and + element = sink.toString() and + value = "" + ) + } +} diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.qlref b/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.qlref deleted file mode 100644 index 8562fa1dce0..00000000000 --- a/java/ql/test/query-tests/security/CWE-079/semmle/tests/XSS.qlref +++ /dev/null @@ -1 +0,0 @@ -Security/CWE/CWE-079/XSS.ql \ No newline at end of file diff --git a/java/ql/test/query-tests/security/CWE-079/semmle/tests/options b/java/ql/test/query-tests/security/CWE-079/semmle/tests/options index 668a863ac60..5fbdfa53a96 100644 --- a/java/ql/test/query-tests/security/CWE-079/semmle/tests/options +++ b/java/ql/test/query-tests/security/CWE-079/semmle/tests/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../../stubs/servlet-api-2.4 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../../stubs/servlet-api-2.4:${testdir}/../../../../../stubs/javax-ws-rs-api-2.1.1/ diff --git a/java/ql/test/query-tests/security/CWE-090/options b/java/ql/test/query-tests/security/CWE-090/options index 08c38d92ad8..20bcd741bf6 100644 --- a/java/ql/test/query-tests/security/CWE-090/options +++ b/java/ql/test/query-tests/security/CWE-090/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/spring-ldap-2.3.2:${testdir}/../../../stubs/unboundid-ldap-4.0.14:${testdir}/../../../stubs/esapi-2.0.1:${testdir}/../../../stubs/apache-ldap-1.0.2 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/spring-ldap-2.3.2:${testdir}/../../../stubs/unboundid-ldap-4.0.14:${testdir}/../../../stubs/esapi-2.0.1:${testdir}/../../../stubs/apache-ldap-1.0.2 diff --git a/java/ql/test/query-tests/security/CWE-094/options b/java/ql/test/query-tests/security/CWE-094/options index 27fdb569cd8..d050cd75232 100644 --- a/java/ql/test/query-tests/security/CWE-094/options +++ b/java/ql/test/query-tests/security/CWE-094/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/validation-api-2.0.1.Final:${testdir}/../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/apache-commons-jexl-2.1.1:${testdir}/../../../stubs/apache-commons-jexl-3.1:${testdir}/../../../stubs/apache-commons-logging-1.2 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/validation-api-2.0.1.Final:${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/apache-commons-jexl-2.1.1:${testdir}/../../../stubs/apache-commons-jexl-3.1:${testdir}/../../../stubs/apache-commons-logging-1.2 diff --git a/java/ql/test/query-tests/security/CWE-502/options b/java/ql/test/query-tests/security/CWE-502/options index ebf1581cc8a..03027487dce 100644 --- a/java/ql/test/query-tests/security/CWE-502/options +++ b/java/ql/test/query-tests/security/CWE-502/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/snakeyaml-1.21:${testdir}/../../../stubs/xstream-1.4.10:${testdir}/../../../stubs/kryo-4.0.2:${testdir}/../../../stubs/jsr311-api-1.1.1:${testdir}/../../../stubs/fastjson-1.2.74:${testdir}/../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/jyaml-1.3:${testdir}/../../../stubs/json-io-4.10.0:${testdir}/../../../stubs/yamlbeans-1.09:${testdir}/../../../stubs/hessian-4.0.38:${testdir}/../../../stubs/castor-1.4.1 +//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/snakeyaml-1.21:${testdir}/../../../stubs/xstream-1.4.10:${testdir}/../../../stubs/kryo-4.0.2:${testdir}/../../../stubs/jsr311-api-1.1.1:${testdir}/../../../stubs/fastjson-1.2.74:${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/jyaml-1.3:${testdir}/../../../stubs/json-io-4.10.0:${testdir}/../../../stubs/yamlbeans-1.09:${testdir}/../../../stubs/hessian-4.0.38:${testdir}/../../../stubs/castor-1.4.1 diff --git a/java/ql/test/query-tests/security/CWE-918/options b/java/ql/test/query-tests/security/CWE-918/options index 79224345b48..b1fc2007fe7 100644 --- a/java/ql/test/query-tests/security/CWE-918/options +++ b/java/ql/test/query-tests/security/CWE-918/options @@ -1 +1 @@ -//semmle-extractor-options: --javac-args -source 11 -target 11 -cp ${testdir}/../../../stubs/springframework-5.2.3:${testdir}/../../../stubs/javax-ws-rs-api-2.1.1:${testdir}/../../../stubs/javax-ws-rs-api-3.0.0:${testdir}/../../../stubs/apache-http-4.4.13/:${testdir}/../../../stubs/servlet-api-2.4/ +//semmle-extractor-options: --javac-args -source 11 -target 11 -cp ${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/javax-ws-rs-api-2.1.1:${testdir}/../../../stubs/javax-ws-rs-api-3.0.0:${testdir}/../../../stubs/apache-http-4.4.13/:${testdir}/../../../stubs/servlet-api-2.4/ diff --git a/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/Produces.java b/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/Produces.java index 2cf426effaa..095f92127c5 100644 --- a/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/Produces.java +++ b/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/Produces.java @@ -16,6 +16,48 @@ package javax.ws.rs; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Defines the media type(s) that the methods of a resource class or + * {@link javax.ws.rs.ext.MessageBodyWriter} can produce. + * If not specified then a container will assume that any type can be produced. + * Method level annotations override a class level annotation. A container + * is responsible for ensuring that the method invoked is capable of producing + * one of the media types requested in the HTTP request. If no such method is + * available the container must respond with a HTTP "406 Not Acceptable" as + * specified by RFC 2616. + * + *

A method for which there is a single-valued {@code @Produces} + * is not required to set the media type of representations that it produces: + * the container will use the value of the {@code @Produces} when + * sending a response.

+ * + * @author Paul Sandoz + * @author Marc Hadley + * @see javax.ws.rs.ext.MessageBodyWriter + * @since 1.0 + */ +@Inherited +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented public @interface Produces { + + /** + * A list of media types. Each entry may specify a single type or consist + * of a comma separated list of types, with any leading or trailing white-spaces + * in a single type entry being ignored. For example: + *
+     *  {"image/jpeg, image/gif ", " image/png"}
+     * 
+ * Use of the comma-separated form allows definition of a common string constant + * for use on multiple targets. + */ String[] value() default "*/*"; -} +} \ No newline at end of file diff --git a/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/core/MediaType.java b/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/core/MediaType.java index 7a026fa016a..35d6968c922 100644 --- a/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/core/MediaType.java +++ b/java/ql/test/stubs/javax-ws-rs-api-2.1.1/javax/ws/rs/core/MediaType.java @@ -18,39 +18,127 @@ package javax.ws.rs.core; import java.util.Map; public class MediaType { - public final static MediaType WILDCARD_TYPE = new MediaType(); - - public final static MediaType APPLICATION_XML_TYPE = new MediaType("application", "xml"); - - public final static MediaType APPLICATION_ATOM_XML_TYPE = new MediaType("application", "atom+xml"); - - public final static MediaType APPLICATION_XHTML_XML_TYPE = new MediaType("application", "xhtml+xml"); - - public final static MediaType APPLICATION_SVG_XML_TYPE = new MediaType("application", "svg+xml"); - - public final static MediaType APPLICATION_JSON_TYPE = new MediaType("application", "json"); - - public final static MediaType APPLICATION_FORM_URLENCODED_TYPE = new MediaType("application", "x-www-form-urlencoded"); - - public final static MediaType MULTIPART_FORM_DATA_TYPE = new MediaType("multipart", "form-data"); - - public final static MediaType APPLICATION_OCTET_STREAM_TYPE = new MediaType("application", "octet-stream"); - - public final static String TEXT_PLAIN = "text/plain"; - - public final static MediaType TEXT_PLAIN_TYPE = new MediaType("text", "plain"); - - public final static String TEXT_XML = "text/xml"; - - public final static MediaType TEXT_XML_TYPE = new MediaType("text", "xml"); - - public final static String TEXT_HTML = "text/html"; - - public final static MediaType TEXT_HTML_TYPE = new MediaType("text", "html"); - - public static final MediaType SERVER_SENT_EVENTS_TYPE = new MediaType("text", "event-stream"); - - public static final MediaType APPLICATION_JSON_PATCH_JSON_TYPE = new MediaType("application", "json-patch+json"); + /** + * The media type {@code charset} parameter name. + */ + public static final String CHARSET_PARAMETER = ""; + /** + * The value of a type or subtype wildcard {@value #MEDIA_TYPE_WILDCARD}. + */ + public static final String MEDIA_TYPE_WILDCARD = ""; + // Common media type constants + /** + * A {@code String} constant representing wildcard {@value #WILDCARD} media type . + */ + public static final String WILDCARD = ""; + /** + * A {@link MediaType} constant representing wildcard {@value #WILDCARD} media type. + */ + public static final MediaType WILDCARD_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_XML} media type. + */ + public static final String APPLICATION_XML = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XML} media type. + */ + public static final MediaType APPLICATION_XML_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_ATOM_XML} media type. + */ + public static final String APPLICATION_ATOM_XML = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ATOM_XML} media type. + */ + public static final MediaType APPLICATION_ATOM_XML_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_XHTML_XML} media type. + */ + public static final String APPLICATION_XHTML_XML = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XHTML_XML} media type. + */ + public static final MediaType APPLICATION_XHTML_XML_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_SVG_XML} media type. + */ + public static final String APPLICATION_SVG_XML = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SVG_XML} media type. + */ + public static final MediaType APPLICATION_SVG_XML_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_JSON} media type. + */ + public static final String APPLICATION_JSON = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSON} media type. + */ + public static final MediaType APPLICATION_JSON_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_FORM_URLENCODED} media type. + */ + public static final String APPLICATION_FORM_URLENCODED = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FORM_URLENCODED} media type. + */ + public static final MediaType APPLICATION_FORM_URLENCODED_TYPE = null; + /** + * A {@code String} constant representing {@value #MULTIPART_FORM_DATA} media type. + */ + public static final String MULTIPART_FORM_DATA = ""; + /** + * A {@link MediaType} constant representing {@value #MULTIPART_FORM_DATA} media type. + */ + public static final MediaType MULTIPART_FORM_DATA_TYPE = null; + /** + * A {@code String} constant representing {@value #APPLICATION_OCTET_STREAM} media type. + */ + public static final String APPLICATION_OCTET_STREAM = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OCTET_STREAM} media type. + */ + public static final MediaType APPLICATION_OCTET_STREAM_TYPE = null; + /** + * A {@code String} constant representing {@value #TEXT_PLAIN} media type. + */ + public static final String TEXT_PLAIN = ""; + /** + * A {@link MediaType} constant representing {@value #TEXT_PLAIN} media type. + */ + public static final MediaType TEXT_PLAIN_TYPE = null; + /** + * A {@code String} constant representing {@value #TEXT_XML} media type. + */ + public static final String TEXT_XML = ""; + /** + * A {@link MediaType} constant representing {@value #TEXT_XML} media type. + */ + public static final MediaType TEXT_XML_TYPE = null; + /** + * A {@code String} constant representing {@value #TEXT_HTML} media type. + */ + public static final String TEXT_HTML = ""; + /** + * A {@link MediaType} constant representing {@value #TEXT_HTML} media type. + */ + public static final MediaType TEXT_HTML_TYPE = null; + /** + * {@link String} representation of Server sent events media type. ("{@value}"). + */ + public static final String SERVER_SENT_EVENTS = ""; + /** + * Server sent events media type. + */ + public static final MediaType SERVER_SENT_EVENTS_TYPE = null; + /** + * {@link String} representation of {@value #APPLICATION_JSON_PATCH_JSON} media type.. + */ + public static final String APPLICATION_JSON_PATCH_JSON = ""; + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSON_PATCH_JSON} media type. + */ + public static final MediaType APPLICATION_JSON_PATCH_JSON_TYPE = null; public static MediaType valueOf(String type){ return null; diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/util/MultiValueMap.java b/java/ql/test/stubs/springframework-5.2.3/org/springframework/util/MultiValueMap.java deleted file mode 100644 index 2429f556502..00000000000 --- a/java/ql/test/stubs/springframework-5.2.3/org/springframework/util/MultiValueMap.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2002-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.util; - -import java.util.List; -import java.util.Map; - -import org.springframework.lang.Nullable; - -/** - * Extension of the {@code Map} interface that stores multiple values. - * - * @author Arjen Poutsma - * @since 3.0 - * @param the key type - * @param the value element type - */ -public interface MultiValueMap extends Map> { - - /** - * Return the first value for the given key. - * @param key the key - * @return the first value for the specified key, or {@code null} if none - */ - @Nullable - V getFirst(K key); - - /** - * Add the given single value to the current list of values for the given key. - * @param key the key - * @param value the value to be added - */ - void add(K key, @Nullable V value); - - /** - * Add all the values of the given list to the current list of values for the given key. - * @param key they key - * @param values the values to be added - * @since 5.0 - */ - void addAll(K key, List values); - - /** - * Add all the values of the given {@code MultiValueMap} to the current values. - * @param values the values to be added - * @since 5.0 - */ - void addAll(MultiValueMap values); - - /** - * {@link #add(Object, Object) Add} the given value, only when the map does not - * {@link #containsKey(Object) contain} the given key. - * @param key the key - * @param value the value to be added - * @since 5.2 - */ - default void addIfAbsent(K key, @Nullable V value) { - if (!containsKey(key)) { - add(key, value); - } - } - - /** - * Set the given single value under the given key. - * @param key the key - * @param value the value to set - */ - void set(K key, @Nullable V value); - - /** - * Set the given values under. - * @param values the values. - */ - void setAll(Map values); - - /** - * Return a {@code Map} with the first values contained in this {@code MultiValueMap}. - * @return a single value representation of this map - */ - Map toSingleValueMap(); - -} diff --git a/java/ql/test/stubs/springframework-5.2.3/LICENSE.txt b/java/ql/test/stubs/springframework-5.3.8/LICENSE.txt similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/LICENSE.txt rename to java/ql/test/stubs/springframework-5.3.8/LICENSE.txt diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/MutablePropertyValues.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/MutablePropertyValues.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/MutablePropertyValues.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/MutablePropertyValues.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/PropertyValue.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/PropertyValue.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/PropertyValue.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/PropertyValue.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/PropertyValues.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/PropertyValues.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/PropertyValues.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/PropertyValues.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/Aware.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/Aware.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/Aware.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/Aware.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/BeanClassLoaderAware.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/BeanClassLoaderAware.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/BeanClassLoaderAware.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/BeanClassLoaderAware.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/BeanFactory.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/BeanFactory.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/BeanFactory.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/BeanFactory.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/HierarchicalBeanFactory.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/HierarchicalBeanFactory.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/HierarchicalBeanFactory.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/HierarchicalBeanFactory.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/InitializingBean.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/InitializingBean.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/InitializingBean.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/InitializingBean.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/ListableBeanFactory.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/ListableBeanFactory.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/ListableBeanFactory.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/ListableBeanFactory.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/annotation/Autowired.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/annotation/Autowired.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/beans/factory/annotation/Autowired.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/beans/factory/annotation/Autowired.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/SpringBootConfiguration.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/SpringBootConfiguration.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/SpringBootConfiguration.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/SpringBootConfiguration.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/actuate/autoconfigure/security/servlet/EndpointRequest.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/autoconfigure/SpringBootApplication.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/autoconfigure/SpringBootApplication.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/autoconfigure/SpringBootApplication.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/autoconfigure/SpringBootApplication.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/context/ApplicationContext.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/context/ApplicationContext.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/context/ApplicationContext.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/context/ApplicationContext.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/context/ApplicationEventPublisher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/context/ApplicationEventPublisher.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/context/ApplicationEventPublisher.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/context/ApplicationEventPublisher.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/context/MessageSource.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/context/MessageSource.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/context/MessageSource.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/context/MessageSource.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/context/annotation/Bean.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/context/annotation/Bean.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/context/annotation/Bean.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/context/annotation/Bean.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/context/annotation/Configuration.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/context/annotation/Configuration.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/context/annotation/Configuration.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/context/annotation/Configuration.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/ParameterizedTypeReference.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/ParameterizedTypeReference.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/ParameterizedTypeReference.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/ParameterizedTypeReference.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/annotation/AliasFor.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/annotation/AliasFor.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/annotation/AliasFor.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/annotation/AliasFor.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/env/EnvironmentCapable.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/env/EnvironmentCapable.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/env/EnvironmentCapable.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/env/EnvironmentCapable.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/InputStreamSource.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/InputStreamSource.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/InputStreamSource.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/InputStreamSource.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/Resource.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/Resource.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/Resource.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/Resource.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/ResourceLoader.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/ResourceLoader.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/ResourceLoader.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/ResourceLoader.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/support/ResourcePatternResolver.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/support/ResourcePatternResolver.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/core/io/support/ResourcePatternResolver.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/core/io/support/ResourcePatternResolver.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/EvaluationContext.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/EvaluationContext.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/EvaluationContext.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/EvaluationContext.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/EvaluationException.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/EvaluationException.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/EvaluationException.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/EvaluationException.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/Expression.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/Expression.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/Expression.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/Expression.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/ExpressionParser.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/ExpressionParser.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/ExpressionParser.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/ExpressionParser.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/standard/SpelExpressionParser.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/standard/SpelExpressionParser.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/standard/SpelExpressionParser.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/standard/SpelExpressionParser.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/support/SimpleEvaluationContext.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/support/SimpleEvaluationContext.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/support/SimpleEvaluationContext.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/support/SimpleEvaluationContext.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/support/StandardEvaluationContext.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/support/StandardEvaluationContext.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/expression/spel/support/StandardEvaluationContext.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/expression/spel/support/StandardEvaluationContext.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpEntity.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpEntity.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpEntity.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpEntity.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpHeaders.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpHeaders.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpHeaders.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpHeaders.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpMethod.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpMethod.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpMethod.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpMethod.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpStatus.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpStatus.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/HttpStatus.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/HttpStatus.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/RequestEntity.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/RequestEntity.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/RequestEntity.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/RequestEntity.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/ResponseEntity.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/ResponseEntity.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/ResponseEntity.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/ResponseEntity.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/http/client/ClientHttpResponse.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/http/client/ClientHttpResponse.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/http/client/ClientHttpResponse.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/http/client/ClientHttpResponse.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/jndi/JndiTemplate.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/jndi/JndiTemplate.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/jndi/JndiTemplate.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/jndi/JndiTemplate.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/lang/Nullable.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/lang/Nullable.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/lang/Nullable.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/lang/Nullable.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/caucho/HessianExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/caucho/HessianExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/caucho/HessianExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/caucho/HessianExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/caucho/HessianServiceExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/caucho/HessianServiceExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/caucho/HessianServiceExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/caucho/HessianServiceExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/httpinvoker/HttpInvokerServiceExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RemoteInvocationSerializingExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RmiBasedExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RmiBasedExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RmiBasedExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RmiBasedExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RmiServiceExporter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RmiServiceExporter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/remoting/rmi/RmiServiceExporter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/remoting/rmi/RmiServiceExporter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/ScriptEvaluator.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/ScriptEvaluator.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/ScriptEvaluator.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/ScriptEvaluator.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/ScriptSource.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/ScriptSource.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/ScriptSource.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/ScriptSource.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/bsh/BshScriptEvaluator.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/bsh/BshScriptEvaluator.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/bsh/BshScriptEvaluator.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/bsh/BshScriptEvaluator.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/support/StaticScriptSource.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/support/StaticScriptSource.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/scripting/support/StaticScriptSource.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/scripting/support/StaticScriptSource.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/Customizer.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/Customizer.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/Customizer.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/Customizer.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/AbstractSecurityBuilder.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/AbstractSecurityBuilder.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/AbstractSecurityBuilder.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/AbstractSecurityBuilder.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityBuilder.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityBuilder.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityBuilder.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityBuilder.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityConfigurer.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityConfigurer.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityConfigurer.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityConfigurer.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/SecurityConfigurerAdapter.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/builders/HttpSecurity.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/builders/HttpSecurity.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/builders/HttpSecurity.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/builders/HttpSecurity.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistry.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistry.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistry.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractConfigAttributeRequestMatcherRegistry.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractHttpConfigurer.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractHttpConfigurer.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractHttpConfigurer.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractHttpConfigurer.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractInterceptUrlConfigurer.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractInterceptUrlConfigurer.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/AbstractInterceptUrlConfigurer.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/AbstractInterceptUrlConfigurer.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/DefaultSecurityFilterChain.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/DefaultSecurityFilterChain.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/DefaultSecurityFilterChain.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/DefaultSecurityFilterChain.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/SecurityFilterChain.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/SecurityFilterChain.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/SecurityFilterChain.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/SecurityFilterChain.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/csrf/CsrfToken.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/csrf/CsrfToken.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/csrf/CsrfToken.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/csrf/CsrfToken.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/savedrequest/SavedRequest.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/savedrequest/SavedRequest.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/savedrequest/SavedRequest.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/savedrequest/SavedRequest.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/savedrequest/SimpleSavedRequest.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/savedrequest/SimpleSavedRequest.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/savedrequest/SimpleSavedRequest.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/savedrequest/SimpleSavedRequest.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/util/matcher/RequestMatcher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/util/matcher/RequestMatcher.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/security/web/util/matcher/RequestMatcher.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/security/web/util/matcher/RequestMatcher.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Component.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Component.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Component.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Component.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Controller.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Controller.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Controller.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Controller.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Indexed.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Indexed.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/stereotype/Indexed.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/stereotype/Indexed.java diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AntPathMatcher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AntPathMatcher.java new file mode 100644 index 00000000000..3b9c487b55e --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AntPathMatcher.java @@ -0,0 +1,37 @@ +// Generated automatically from org.springframework.util.AntPathMatcher for testing purposes + +package org.springframework.util; + +import java.util.Comparator; +import java.util.Map; +import org.springframework.util.PathMatcher; + +public class AntPathMatcher implements PathMatcher +{ + final Map stringMatcherCache = null; + protected AntPathMatcher.AntPathStringMatcher getStringMatcher(String p0){ return null; } + protected String[] tokenizePath(String p0){ return null; } + protected String[] tokenizePattern(String p0){ return null; } + protected boolean doMatch(String p0, String p1, boolean p2, Map p3){ return false; } + public AntPathMatcher(){} + public AntPathMatcher(String p0){} + public Comparator getPatternComparator(String p0){ return null; } + public Map extractUriTemplateVariables(String p0, String p1){ return null; } + public String combine(String p0, String p1){ return null; } + public String extractPathWithinPattern(String p0, String p1){ return null; } + public boolean isPattern(String p0){ return false; } + public boolean match(String p0, String p1){ return false; } + public boolean matchStart(String p0, String p1){ return false; } + public static String DEFAULT_PATH_SEPARATOR = null; + public void setCachePatterns(boolean p0){} + public void setCaseSensitive(boolean p0){} + public void setPathSeparator(String p0){} + public void setTrimTokens(boolean p0){} + static class AntPathStringMatcher + { + protected AntPathStringMatcher() {} + public AntPathStringMatcher(String p0){} + public AntPathStringMatcher(String p0, boolean p1){} + public boolean matchStrings(String p0, Map p1){ return false; } + } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AutoPopulatingList.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AutoPopulatingList.java new file mode 100644 index 00000000000..b3b4be423fe --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/AutoPopulatingList.java @@ -0,0 +1,53 @@ +// Generated automatically from org.springframework.util.AutoPopulatingList for testing purposes + +package org.springframework.util; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +public class AutoPopulatingList implements List, Serializable +{ + protected AutoPopulatingList() {} + public T[] toArray(T[] p0){ return null; } + public AutoPopulatingList(AutoPopulatingList.ElementFactory p0){} + public AutoPopulatingList(Class p0){} + public AutoPopulatingList(List p0, AutoPopulatingList.ElementFactory p1){} + public AutoPopulatingList(List p0, Class p1){} + public E get(int p0){ return null; } + public E remove(int p0){ return null; } + public E set(int p0, E p1){ return null; } + public Iterator iterator(){ return null; } + public List subList(int p0, int p1){ return null; } + public ListIterator listIterator(){ return null; } + public ListIterator listIterator(int p0){ return null; } + public Object[] toArray(){ return null; } + public boolean add(E p0){ return false; } + public boolean addAll(Collection p0){ return false; } + public boolean addAll(int p0, Collection p1){ return false; } + public boolean contains(Object p0){ return false; } + public boolean containsAll(Collection p0){ return false; } + public boolean equals(Object p0){ return false; } + public boolean isEmpty(){ return false; } + public boolean remove(Object p0){ return false; } + public boolean removeAll(Collection p0){ return false; } + public boolean retainAll(Collection p0){ return false; } + public int hashCode(){ return 0; } + public int indexOf(Object p0){ return 0; } + public int lastIndexOf(Object p0){ return 0; } + public int size(){ return 0; } + public void add(int p0, E p1){} + public void clear(){} + static public class ElementInstantiationException extends RuntimeException + { + protected ElementInstantiationException() {} + public ElementInstantiationException(String p0){} + public ElementInstantiationException(String p0, Throwable p1){} + } + static public interface ElementFactory + { + E createElement(int p0); + } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/Base64Utils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/Base64Utils.java new file mode 100644 index 00000000000..9713e1fb078 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/Base64Utils.java @@ -0,0 +1,17 @@ +// Generated automatically from org.springframework.util.Base64Utils for testing purposes + +package org.springframework.util; + + +abstract public class Base64Utils +{ + public Base64Utils(){} + public static String encodeToString(byte[] p0){ return null; } + public static String encodeToUrlSafeString(byte[] p0){ return null; } + public static byte[] decode(byte[] p0){ return null; } + public static byte[] decodeFromString(String p0){ return null; } + public static byte[] decodeFromUrlSafeString(String p0){ return null; } + public static byte[] decodeUrlSafe(byte[] p0){ return null; } + public static byte[] encode(byte[] p0){ return null; } + public static byte[] encodeUrlSafe(byte[] p0){ return null; } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CollectionUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CollectionUtils.java new file mode 100644 index 00000000000..93ed1aab0b7 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CollectionUtils.java @@ -0,0 +1,44 @@ +// Generated automatically from org.springframework.util.CollectionUtils for testing purposes + +package org.springframework.util; + +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import org.springframework.util.MultiValueMap; + +abstract public class CollectionUtils +{ + public CollectionUtils(){} + public static A[] toArray(Enumeration p0, A[] p1){ return null; } + public static E findFirstMatch(Collection p0, Collection p1){ return null; } + public static Iterator toIterator(Enumeration p0){ return null; } + public static void mergeArrayIntoCollection(Object p0, Collection p1){} + public static HashMap newHashMap(int p0){ return null; } + public static LinkedHashMap newLinkedHashMap(int p0){ return null; } + public static MultiValueMap toMultiValueMap(Map> p0){ return null; } + public static MultiValueMap unmodifiableMultiValueMap(MultiValueMap p0){ return null; } + public static void mergePropertiesIntoMap(Properties p0, Map p1){} + public static T findValueOfType(Collection p0, Class p1){ return null; } + public static T firstElement(List p0){ return null; } + public static T firstElement(Set p0){ return null; } + public static T lastElement(List p0){ return null; } + public static T lastElement(Set p0){ return null; } + public static Class findCommonElementType(Collection p0){ return null; } + public static List arrayToList(Object p0){ return null; } + public static Object findValueOfType(Collection p0, Class[] p1){ return null; } + public static boolean contains(Enumeration p0, Object p1){ return false; } + public static boolean contains(Iterator p0, Object p1){ return false; } + public static boolean containsAny(Collection p0, Collection p1){ return false; } + public static boolean containsInstance(Collection p0, Object p1){ return false; } + public static boolean hasUniqueObject(Collection p0){ return false; } + public static boolean isEmpty(Collection p0){ return false; } + public static boolean isEmpty(Map p0){ return false; } + static float DEFAULT_LOAD_FACTOR = 0; +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CompositeIterator.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CompositeIterator.java new file mode 100644 index 00000000000..24e5d12b7c3 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/CompositeIterator.java @@ -0,0 +1,14 @@ +// Generated automatically from org.springframework.util.CompositeIterator for testing purposes + +package org.springframework.util; + +import java.util.Iterator; + +public class CompositeIterator implements Iterator +{ + public CompositeIterator(){} + public E next(){ return null; } + public boolean hasNext(){ return false; } + public void add(Iterator p0){} + public void remove(){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FastByteArrayOutputStream.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FastByteArrayOutputStream.java new file mode 100644 index 00000000000..3a04591c23c --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FastByteArrayOutputStream.java @@ -0,0 +1,23 @@ +// Generated automatically from org.springframework.util.FastByteArrayOutputStream for testing purposes + +package org.springframework.util; + +import java.io.InputStream; +import java.io.OutputStream; + +public class FastByteArrayOutputStream extends OutputStream +{ + public FastByteArrayOutputStream(){} + public FastByteArrayOutputStream(int p0){} + public InputStream getInputStream(){ return null; } + public String toString(){ return null; } + public byte[] toByteArray(){ return null; } + public byte[] toByteArrayUnsafe(){ return null; } + public int size(){ return 0; } + public void close(){} + public void reset(){} + public void resize(int p0){} + public void write(byte[] p0, int p1, int p2){} + public void write(int p0){} + public void writeTo(OutputStream p0){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileCopyUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileCopyUtils.java new file mode 100644 index 00000000000..98ae68c9a64 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileCopyUtils.java @@ -0,0 +1,24 @@ +// Generated automatically from org.springframework.util.FileCopyUtils for testing purposes + +package org.springframework.util; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; + +abstract public class FileCopyUtils +{ + public FileCopyUtils(){} + public static String copyToString(Reader p0){ return null; } + public static byte[] copyToByteArray(File p0){ return null; } + public static byte[] copyToByteArray(InputStream p0){ return null; } + public static int BUFFER_SIZE = 0; + public static int copy(File p0, File p1){ return 0; } + public static int copy(InputStream p0, OutputStream p1){ return 0; } + public static int copy(Reader p0, Writer p1){ return 0; } + public static void copy(String p0, Writer p1){} + public static void copy(byte[] p0, File p1){} + public static void copy(byte[] p0, OutputStream p1){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileSystemUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileSystemUtils.java new file mode 100644 index 00000000000..75525989d70 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/FileSystemUtils.java @@ -0,0 +1,15 @@ +// Generated automatically from org.springframework.util.FileSystemUtils for testing purposes + +package org.springframework.util; + +import java.io.File; +import java.nio.file.Path; + +abstract public class FileSystemUtils +{ + public FileSystemUtils(){} + public static boolean deleteRecursively(File p0){ return false; } + public static boolean deleteRecursively(Path p0){ return false; } + public static void copyRecursively(File p0, File p1){} + public static void copyRecursively(Path p0, Path p1){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/LinkedMultiValueMap.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/LinkedMultiValueMap.java new file mode 100644 index 00000000000..789cf2e1b20 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/LinkedMultiValueMap.java @@ -0,0 +1,17 @@ +// Generated automatically from org.springframework.util.LinkedMultiValueMap for testing purposes + +package org.springframework.util; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import org.springframework.util.MultiValueMapAdapter; + +public class LinkedMultiValueMap extends MultiValueMapAdapter implements Cloneable, Serializable +{ + public LinkedMultiValueMap(){} + public LinkedMultiValueMap(Map> p0){} + public LinkedMultiValueMap(int p0){} + public LinkedMultiValueMap clone(){ return null; } + public LinkedMultiValueMap deepCopy(){ return null; } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMap.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMap.java new file mode 100644 index 00000000000..771872ce302 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMap.java @@ -0,0 +1,18 @@ +// Generated automatically from org.springframework.util.MultiValueMap for testing purposes + +package org.springframework.util; + +import java.util.List; +import java.util.Map; + +public interface MultiValueMap extends Map> +{ + Map toSingleValueMap(); + V getFirst(K p0); + default void addIfAbsent(K p0, V p1){} + void add(K p0, V p1); + void addAll(K p0, List p1); + void addAll(MultiValueMap p0); + void set(K p0, V p1); + void setAll(Map p0); +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMapAdapter.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMapAdapter.java new file mode 100644 index 00000000000..1edfb4add7a --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/MultiValueMapAdapter.java @@ -0,0 +1,38 @@ +// Generated automatically from org.springframework.util.MultiValueMapAdapter for testing purposes + +package org.springframework.util; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.springframework.util.MultiValueMap; + +public class MultiValueMapAdapter implements MultiValueMap, Serializable +{ + protected MultiValueMapAdapter() {} + public Collection> values(){ return null; } + public List get(Object p0){ return null; } + public List put(K p0, List p1){ return null; } + public List remove(Object p0){ return null; } + public Map toSingleValueMap(){ return null; } + public MultiValueMapAdapter(Map> p0){} + public Set keySet(){ return null; } + public Set>> entrySet(){ return null; } + public String toString(){ return null; } + public V getFirst(K p0){ return null; } + public boolean containsKey(Object p0){ return false; } + public boolean containsValue(Object p0){ return false; } + public boolean equals(Object p0){ return false; } + public boolean isEmpty(){ return false; } + public int hashCode(){ return 0; } + public int size(){ return 0; } + public void add(K p0, V p1){} + public void addAll(K p0, List p1){} + public void addAll(MultiValueMap p0){} + public void clear(){} + public void putAll(Map> p0){} + public void set(K p0, V p1){} + public void setAll(Map p0){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ObjectUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ObjectUtils.java new file mode 100644 index 00000000000..06465de20fb --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ObjectUtils.java @@ -0,0 +1,50 @@ +// Generated automatically from org.springframework.util.ObjectUtils for testing purposes + +package org.springframework.util; + + +abstract public class ObjectUtils +{ + public ObjectUtils(){} + public static A[] addObjectToArray(A[] p0, O p1){ return null; } + public static > E caseInsensitiveValueOf(E[] p0, String p1){ return null; } + public static Object unwrapOptional(Object p0){ return null; } + public static Object[] toObjectArray(Object p0){ return null; } + public static String getDisplayString(Object p0){ return null; } + public static String getIdentityHexString(Object p0){ return null; } + public static String identityToString(Object p0){ return null; } + public static String nullSafeClassName(Object p0){ return null; } + public static String nullSafeToString(Object p0){ return null; } + public static String nullSafeToString(Object[] p0){ return null; } + public static String nullSafeToString(boolean[] p0){ return null; } + public static String nullSafeToString(byte[] p0){ return null; } + public static String nullSafeToString(char[] p0){ return null; } + public static String nullSafeToString(double[] p0){ return null; } + public static String nullSafeToString(float[] p0){ return null; } + public static String nullSafeToString(int[] p0){ return null; } + public static String nullSafeToString(long[] p0){ return null; } + public static String nullSafeToString(short[] p0){ return null; } + public static boolean containsConstant(Enum[] p0, String p1){ return false; } + public static boolean containsConstant(Enum[] p0, String p1, boolean p2){ return false; } + public static boolean containsElement(Object[] p0, Object p1){ return false; } + public static boolean isArray(Object p0){ return false; } + public static boolean isCheckedException(Throwable p0){ return false; } + public static boolean isCompatibleWithThrowsClause(Throwable p0, Class... p1){ return false; } + public static boolean isEmpty(Object p0){ return false; } + public static boolean isEmpty(Object[] p0){ return false; } + public static boolean nullSafeEquals(Object p0, Object p1){ return false; } + public static int hashCode(boolean p0){ return 0; } + public static int hashCode(double p0){ return 0; } + public static int hashCode(float p0){ return 0; } + public static int hashCode(long p0){ return 0; } + public static int nullSafeHashCode(Object p0){ return 0; } + public static int nullSafeHashCode(Object[] p0){ return 0; } + public static int nullSafeHashCode(boolean[] p0){ return 0; } + public static int nullSafeHashCode(byte[] p0){ return 0; } + public static int nullSafeHashCode(char[] p0){ return 0; } + public static int nullSafeHashCode(double[] p0){ return 0; } + public static int nullSafeHashCode(float[] p0){ return 0; } + public static int nullSafeHashCode(int[] p0){ return 0; } + public static int nullSafeHashCode(long[] p0){ return 0; } + public static int nullSafeHashCode(short[] p0){ return 0; } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PathMatcher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PathMatcher.java new file mode 100644 index 00000000000..4f5128f7a77 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PathMatcher.java @@ -0,0 +1,17 @@ +// Generated automatically from org.springframework.util.PathMatcher for testing purposes + +package org.springframework.util; + +import java.util.Comparator; +import java.util.Map; + +public interface PathMatcher +{ + Comparator getPatternComparator(String p0); + Map extractUriTemplateVariables(String p0, String p1); + String combine(String p0, String p1); + String extractPathWithinPattern(String p0, String p1); + boolean isPattern(String p0); + boolean match(String p0, String p1); + boolean matchStart(String p0, String p1); +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertiesPersister.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertiesPersister.java new file mode 100644 index 00000000000..c64fea6b5a8 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertiesPersister.java @@ -0,0 +1,20 @@ +// Generated automatically from org.springframework.util.PropertiesPersister for testing purposes + +package org.springframework.util; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Properties; + +public interface PropertiesPersister +{ + void load(Properties p0, InputStream p1); + void load(Properties p0, Reader p1); + void loadFromXml(Properties p0, InputStream p1); + void store(Properties p0, OutputStream p1, String p2); + void store(Properties p0, Writer p1, String p2); + void storeToXml(Properties p0, OutputStream p1, String p2); + void storeToXml(Properties p0, OutputStream p1, String p2, String p3); +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertyPlaceholderHelper.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertyPlaceholderHelper.java new file mode 100644 index 00000000000..53c583dd7d4 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/PropertyPlaceholderHelper.java @@ -0,0 +1,20 @@ +// Generated automatically from org.springframework.util.PropertyPlaceholderHelper for testing purposes + +package org.springframework.util; + +import java.util.Properties; +import java.util.Set; + +public class PropertyPlaceholderHelper +{ + protected PropertyPlaceholderHelper() {} + protected String parseStringValue(String p0, PropertyPlaceholderHelper.PlaceholderResolver p1, Set p2){ return null; } + public PropertyPlaceholderHelper(String p0, String p1){} + public PropertyPlaceholderHelper(String p0, String p1, String p2, boolean p3){} + public String replacePlaceholders(String p0, Properties p1){ return null; } + public String replacePlaceholders(String p0, PropertyPlaceholderHelper.PlaceholderResolver p1){ return null; } + static public interface PlaceholderResolver + { + String resolvePlaceholder(String p0); + } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ResourceUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ResourceUtils.java new file mode 100644 index 00000000000..282da313286 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/ResourceUtils.java @@ -0,0 +1,43 @@ +// Generated automatically from org.springframework.util.ResourceUtils for testing purposes + +package org.springframework.util; + +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; + +abstract public class ResourceUtils +{ + public ResourceUtils(){} + public static File getFile(String p0){ return null; } + public static File getFile(URI p0){ return null; } + public static File getFile(URI p0, String p1){ return null; } + public static File getFile(URL p0){ return null; } + public static File getFile(URL p0, String p1){ return null; } + public static String CLASSPATH_URL_PREFIX = null; + public static String FILE_URL_PREFIX = null; + public static String JAR_FILE_EXTENSION = null; + public static String JAR_URL_PREFIX = null; + public static String JAR_URL_SEPARATOR = null; + public static String URL_PROTOCOL_FILE = null; + public static String URL_PROTOCOL_JAR = null; + public static String URL_PROTOCOL_VFS = null; + public static String URL_PROTOCOL_VFSFILE = null; + public static String URL_PROTOCOL_VFSZIP = null; + public static String URL_PROTOCOL_WAR = null; + public static String URL_PROTOCOL_WSJAR = null; + public static String URL_PROTOCOL_ZIP = null; + public static String WAR_URL_PREFIX = null; + public static String WAR_URL_SEPARATOR = null; + public static URI toURI(String p0){ return null; } + public static URI toURI(URL p0){ return null; } + public static URL extractArchiveURL(URL p0){ return null; } + public static URL extractJarFileURL(URL p0){ return null; } + public static URL getURL(String p0){ return null; } + public static boolean isFileURL(URL p0){ return false; } + public static boolean isJarFileURL(URL p0){ return false; } + public static boolean isJarURL(URL p0){ return false; } + public static boolean isUrl(String p0){ return false; } + public static void useCachesIfNecessary(URLConnection p0){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/RouteMatcher.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/RouteMatcher.java new file mode 100644 index 00000000000..65d37ed5aab --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/RouteMatcher.java @@ -0,0 +1,20 @@ +// Generated automatically from org.springframework.util.RouteMatcher for testing purposes + +package org.springframework.util; + +import java.util.Comparator; +import java.util.Map; + +public interface RouteMatcher +{ + Comparator getPatternComparator(RouteMatcher.Route p0); + Map matchAndExtract(String p0, RouteMatcher.Route p1); + RouteMatcher.Route parseRoute(String p0); + String combine(String p0, String p1); + boolean isPattern(String p0); + boolean match(String p0, RouteMatcher.Route p1); + static public interface Route + { + String value(); + } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SerializationUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SerializationUtils.java new file mode 100644 index 00000000000..60ad8174484 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SerializationUtils.java @@ -0,0 +1,11 @@ +// Generated automatically from org.springframework.util.SerializationUtils for testing purposes + +package org.springframework.util; + + +abstract public class SerializationUtils +{ + public SerializationUtils(){} + public static Object deserialize(byte[] p0){ return null; } + public static byte[] serialize(Object p0){ return null; } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StreamUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StreamUtils.java new file mode 100644 index 00000000000..d042deb3f61 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StreamUtils.java @@ -0,0 +1,25 @@ +// Generated automatically from org.springframework.util.StreamUtils for testing purposes + +package org.springframework.util; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.Charset; + +abstract public class StreamUtils +{ + public StreamUtils(){} + public static InputStream emptyInput(){ return null; } + public static InputStream nonClosing(InputStream p0){ return null; } + public static OutputStream nonClosing(OutputStream p0){ return null; } + public static String copyToString(ByteArrayOutputStream p0, Charset p1){ return null; } + public static String copyToString(InputStream p0, Charset p1){ return null; } + public static byte[] copyToByteArray(InputStream p0){ return null; } + public static int BUFFER_SIZE = 0; + public static int copy(InputStream p0, OutputStream p1){ return 0; } + public static int drain(InputStream p0){ return 0; } + public static long copyRange(InputStream p0, OutputStream p1, long p2, long p3){ return 0; } + public static void copy(String p0, Charset p1, OutputStream p2){} + public static void copy(byte[] p0, OutputStream p1){} +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringUtils.java new file mode 100644 index 00000000000..20ebeb1e0fe --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringUtils.java @@ -0,0 +1,76 @@ +// Generated automatically from org.springframework.util.StringUtils for testing purposes + +package org.springframework.util; + +import java.nio.charset.Charset; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Properties; +import java.util.Set; +import java.util.TimeZone; + +abstract public class StringUtils +{ + public StringUtils(){} + public static Locale parseLocale(String p0){ return null; } + public static Locale parseLocaleString(String p0){ return null; } + public static Object quoteIfString(Object p0){ return null; } + public static Properties splitArrayElementsIntoProperties(String[] p0, String p1){ return null; } + public static Properties splitArrayElementsIntoProperties(String[] p0, String p1, String p2){ return null; } + public static Set commaDelimitedListToSet(String p0){ return null; } + public static String applyRelativePath(String p0, String p1){ return null; } + public static String arrayToCommaDelimitedString(Object[] p0){ return null; } + public static String arrayToDelimitedString(Object[] p0, String p1){ return null; } + public static String capitalize(String p0){ return null; } + public static String cleanPath(String p0){ return null; } + public static String collectionToCommaDelimitedString(Collection p0){ return null; } + public static String collectionToDelimitedString(Collection p0, String p1){ return null; } + public static String collectionToDelimitedString(Collection p0, String p1, String p2, String p3){ return null; } + public static String delete(String p0, String p1){ return null; } + public static String deleteAny(String p0, String p1){ return null; } + public static String getFilename(String p0){ return null; } + public static String getFilenameExtension(String p0){ return null; } + public static String quote(String p0){ return null; } + public static String replace(String p0, String p1, String p2){ return null; } + public static String stripFilenameExtension(String p0){ return null; } + public static String toLanguageTag(Locale p0){ return null; } + public static String trimAllWhitespace(String p0){ return null; } + public static String trimLeadingCharacter(String p0, char p1){ return null; } + public static String trimLeadingWhitespace(String p0){ return null; } + public static String trimTrailingCharacter(String p0, char p1){ return null; } + public static String trimTrailingWhitespace(String p0){ return null; } + public static String trimWhitespace(String p0){ return null; } + public static String uncapitalize(String p0){ return null; } + public static String unqualify(String p0){ return null; } + public static String unqualify(String p0, char p1){ return null; } + public static String uriDecode(String p0, Charset p1){ return null; } + public static String[] addStringToArray(String[] p0, String p1){ return null; } + public static String[] commaDelimitedListToStringArray(String p0){ return null; } + public static String[] concatenateStringArrays(String[] p0, String[] p1){ return null; } + public static String[] delimitedListToStringArray(String p0, String p1){ return null; } + public static String[] delimitedListToStringArray(String p0, String p1, String p2){ return null; } + public static String[] mergeStringArrays(String[] p0, String[] p1){ return null; } + public static String[] removeDuplicateStrings(String[] p0){ return null; } + public static String[] sortStringArray(String[] p0){ return null; } + public static String[] split(String p0, String p1){ return null; } + public static String[] toStringArray(Collection p0){ return null; } + public static String[] toStringArray(Enumeration p0){ return null; } + public static String[] tokenizeToStringArray(String p0, String p1){ return null; } + public static String[] tokenizeToStringArray(String p0, String p1, boolean p2, boolean p3){ return null; } + public static String[] trimArrayElements(String[] p0){ return null; } + public static TimeZone parseTimeZoneString(String p0){ return null; } + public static boolean containsWhitespace(CharSequence p0){ return false; } + public static boolean containsWhitespace(String p0){ return false; } + public static boolean endsWithIgnoreCase(String p0, String p1){ return false; } + public static boolean hasLength(CharSequence p0){ return false; } + public static boolean hasLength(String p0){ return false; } + public static boolean hasText(CharSequence p0){ return false; } + public static boolean hasText(String p0){ return false; } + public static boolean isEmpty(Object p0){ return false; } + public static boolean matchesCharacter(String p0, char p1){ return false; } + public static boolean pathEquals(String p0, String p1){ return false; } + public static boolean startsWithIgnoreCase(String p0, String p1){ return false; } + public static boolean substringMatch(CharSequence p0, int p1, CharSequence p2){ return false; } + public static int countOccurrencesOf(String p0, String p1){ return 0; } +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringValueResolver.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringValueResolver.java new file mode 100644 index 00000000000..ffd3e446cd3 --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/StringValueResolver.java @@ -0,0 +1,9 @@ +// Generated automatically from org.springframework.util.StringValueResolver for testing purposes + +package org.springframework.util; + + +public interface StringValueResolver +{ + String resolveStringValue(String p0); +} diff --git a/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SystemPropertyUtils.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SystemPropertyUtils.java new file mode 100644 index 00000000000..a24dc9d629c --- /dev/null +++ b/java/ql/test/stubs/springframework-5.3.8/org/springframework/util/SystemPropertyUtils.java @@ -0,0 +1,14 @@ +// Generated automatically from org.springframework.util.SystemPropertyUtils for testing purposes + +package org.springframework.util; + + +abstract public class SystemPropertyUtils +{ + public SystemPropertyUtils(){} + public static String PLACEHOLDER_PREFIX = null; + public static String PLACEHOLDER_SUFFIX = null; + public static String VALUE_SEPARATOR = null; + public static String resolvePlaceholders(String p0){ return null; } + public static String resolvePlaceholders(String p0, boolean p1){ return null; } +} diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/GetMapping.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/GetMapping.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/GetMapping.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/GetMapping.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/Mapping.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/Mapping.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/Mapping.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/Mapping.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/PathVariable.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/PathVariable.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/PathVariable.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/PathVariable.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/PostMapping.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/PostMapping.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/PostMapping.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/PostMapping.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestBody.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestBody.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestBody.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestBody.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestMapping.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestMapping.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestMapping.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestMapping.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestMethod.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestMethod.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestMethod.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestMethod.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestParam.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestParam.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/RequestParam.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/RequestParam.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/ResponseBody.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/ResponseBody.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/bind/annotation/ResponseBody.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/bind/annotation/ResponseBody.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RequestCallback.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RequestCallback.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RequestCallback.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RequestCallback.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/ResponseExtractor.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/ResponseExtractor.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/ResponseExtractor.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/ResponseExtractor.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RestClientException.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RestClientException.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RestClientException.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RestClientException.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RestTemplate.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RestTemplate.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/client/RestTemplate.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/client/RestTemplate.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/context/WebApplicationContext.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/context/WebApplicationContext.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/context/WebApplicationContext.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/context/WebApplicationContext.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/multipart/MultipartFile.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/multipart/MultipartFile.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/multipart/MultipartFile.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/multipart/MultipartFile.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/multipart/MultipartRequest.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/multipart/MultipartRequest.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/multipart/MultipartRequest.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/multipart/MultipartRequest.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/ModelAndView.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/ModelAndView.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/ModelAndView.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/ModelAndView.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/View.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/View.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/View.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/View.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/view/AbstractUrlBasedView.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/view/AbstractUrlBasedView.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/view/AbstractUrlBasedView.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/view/AbstractUrlBasedView.java diff --git a/java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/view/RedirectView.java b/java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/view/RedirectView.java similarity index 100% rename from java/ql/test/stubs/springframework-5.2.3/org/springframework/web/servlet/view/RedirectView.java rename to java/ql/test/stubs/springframework-5.3.8/org/springframework/web/servlet/view/RedirectView.java diff --git a/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/old.dbscheme b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/old.dbscheme new file mode 100755 index 00000000000..60a4ba1a475 --- /dev/null +++ b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/old.dbscheme @@ -0,0 +1,982 @@ +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * javac A.java B.java C.java + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * javac A.java B.java C.java + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * javac A.java B.java C.java + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--javac-args` + * 2 | A.java + * 3 | B.java + * 4 | C.java + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * javac A.java B.java C.java + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | A.java + * 1 | B.java + * 2 | C.java + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + unique int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/* + * External artifacts + */ + +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +snapshotDate( + unique date snapshotDate : date ref +); + +sourceLocationPrefix( + string prefix : string ref +); + +/* + * Duplicate code + */ + +duplicateCode( + unique int id : @duplication, + string relativePath : string ref, + int equivClass : int ref +); + +similarCode( + unique int id : @similarity, + string relativePath : string ref, + int equivClass : int ref +); + +@duplication_or_similarity = @duplication | @similarity + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref +); + +/* + * SMAP + */ + +smap_header( + int outputFileId: @file ref, + string outputFilename: string ref, + string defaultStratum: string ref +); + +smap_files( + int outputFileId: @file ref, + string stratum: string ref, + int inputFileNum: int ref, + string inputFileName: string ref, + int inputFileId: @file ref +); + +smap_lines( + int outputFileId: @file ref, + string stratum: string ref, + int inputFileNum: int ref, + int inputStartLine: int ref, + int inputLineCount: int ref, + int outputStartLine: int ref, + int outputLineIncrement: int ref +); + +/* + * Locations and files + */ + +@location = @location_default ; + +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +hasLocation( + int locatableid: @locatable ref, + int id: @location ref +); + +@sourceline = @locatable ; + +#keyset[element_id] +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +files( + unique int id: @file, + string name: string ref, + string simple: string ref, + string ext: string ref, + int fromSource: int ref // deprecated +); + +folders( + unique int id: @folder, + string name: string ref, + string simple: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/* + * Java + */ + +cupackage( + unique int id: @file ref, + int packageid: @package ref +); + +#keyset[fileid,keyName] +jarManifestMain( + int fileid: @file ref, + string keyName: string ref, + string value: string ref +); + +#keyset[fileid,entryName,keyName] +jarManifestEntries( + int fileid: @file ref, + string entryName: string ref, + string keyName: string ref, + string value: string ref +); + +packages( + unique int id: @package, + string nodeName: string ref +); + +primitives( + unique int id: @primitive, + string nodeName: string ref +); + +modifiers( + unique int id: @modifier, + string nodeName: string ref +); + +classes( + unique int id: @class, + string nodeName: string ref, + int parentid: @package ref, + int sourceid: @class ref +); + +isRecord( + unique int id: @class ref +); + +interfaces( + unique int id: @interface, + string nodeName: string ref, + int parentid: @package ref, + int sourceid: @interface ref +); + +fielddecls( + unique int id: @fielddecl, + int parentid: @reftype ref +); + +#keyset[fieldId] #keyset[fieldDeclId,pos] +fieldDeclaredIn( + int fieldId: @field ref, + int fieldDeclId: @fielddecl ref, + int pos: int ref +); + +fields( + unique int id: @field, + string nodeName: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @field ref +); + +constrs( + unique int id: @constructor, + string nodeName: string ref, + string signature: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @constructor ref +); + +methods( + unique int id: @method, + string nodeName: string ref, + string signature: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @method ref +); + +#keyset[parentid,pos] +params( + unique int id: @param, + int typeid: @type ref, + int pos: int ref, + int parentid: @callable ref, + int sourceid: @param ref +); + +paramName( + unique int id: @param ref, + string nodeName: string ref +); + +isVarargsParam( + int param: @param ref +); + +exceptions( + unique int id: @exception, + int typeid: @type ref, + int parentid: @callable ref +); + +isAnnotType( + int interfaceid: @interface ref +); + +isAnnotElem( + int methodid: @method ref +); + +annotValue( + int parentid: @annotation ref, + int id2: @method ref, + unique int value: @expr ref +); + +isEnumType( + int classid: @class ref +); + +isEnumConst( + int fieldid: @field ref +); + +#keyset[parentid,pos] +typeVars( + unique int id: @typevariable, + string nodeName: string ref, + int pos: int ref, + int kind: int ref, // deprecated + int parentid: @typeorcallable ref +); + +wildcards( + unique int id: @wildcard, + string nodeName: string ref, + int kind: int ref +); + +#keyset[parentid,pos] +typeBounds( + unique int id: @typebound, + int typeid: @reftype ref, + int pos: int ref, + int parentid: @boundedtype ref +); + +#keyset[parentid,pos] +typeArgs( + int argumentid: @reftype ref, + int pos: int ref, + int parentid: @typeorcallable ref +); + +isParameterized( + int memberid: @member ref +); + +isRaw( + int memberid: @member ref +); + +erasure( + unique int memberid: @member ref, + int erasureid: @member ref +); + +#keyset[classid] #keyset[parent] +isAnonymClass( + int classid: @class ref, + int parent: @classinstancexpr ref +); + +#keyset[classid] #keyset[parent] +isLocalClass( + int classid: @class ref, + int parent: @localclassdeclstmt ref +); + +isDefConstr( + int constructorid: @constructor ref +); + +#keyset[exprId] +lambdaKind( + int exprId: @lambdaexpr ref, + int bodyKind: int ref +); + +arrays( + unique int id: @array, + string nodeName: string ref, + int elementtypeid: @type ref, + int dimension: int ref, + int componenttypeid: @type ref +); + +enclInReftype( + unique int child: @reftype ref, + int parent: @reftype ref +); + +extendsReftype( + int id1: @reftype ref, + int id2: @classorinterface ref +); + +implInterface( + int id1: @classorarray ref, + int id2: @interface ref +); + +hasModifier( + int id1: @modifiable ref, + int id2: @modifier ref +); + +imports( + unique int id: @import, + int holder: @typeorpackage ref, + string name: string ref, + int kind: int ref +); + +#keyset[parent,idx] +stmts( + unique int id: @stmt, + int kind: int ref, + int parent: @stmtparent ref, + int idx: int ref, + int bodydecl: @callable ref +); + +@stmtparent = @callable | @stmt | @switchexpr; + +case @stmt.kind of + 0 = @block +| 1 = @ifstmt +| 2 = @forstmt +| 3 = @enhancedforstmt +| 4 = @whilestmt +| 5 = @dostmt +| 6 = @trystmt +| 7 = @switchstmt +| 8 = @synchronizedstmt +| 9 = @returnstmt +| 10 = @throwstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @emptystmt +| 14 = @exprstmt +| 15 = @labeledstmt +| 16 = @assertstmt +| 17 = @localvariabledeclstmt +| 18 = @localclassdeclstmt +| 19 = @constructorinvocationstmt +| 20 = @superconstructorinvocationstmt +| 21 = @case +| 22 = @catchclause +| 23 = @yieldstmt +; + +#keyset[parent,idx] +exprs( + unique int id: @expr, + int kind: int ref, + int typeid: @type ref, + int parent: @exprparent ref, + int idx: int ref +); + +callableEnclosingExpr( + unique int id: @expr ref, + int callable_id: @callable ref +); + +statementEnclosingExpr( + unique int id: @expr ref, + int statement_id: @stmt ref +); + +isParenthesized( + unique int id: @expr ref, + int parentheses: int ref +); + +case @expr.kind of + 1 = @arrayaccess +| 2 = @arraycreationexpr +| 3 = @arrayinit +| 4 = @assignexpr +| 5 = @assignaddexpr +| 6 = @assignsubexpr +| 7 = @assignmulexpr +| 8 = @assigndivexpr +| 9 = @assignremexpr +| 10 = @assignandexpr +| 11 = @assignorexpr +| 12 = @assignxorexpr +| 13 = @assignlshiftexpr +| 14 = @assignrshiftexpr +| 15 = @assignurshiftexpr +| 16 = @booleanliteral +| 17 = @integerliteral +| 18 = @longliteral +| 19 = @floatingpointliteral +| 20 = @doubleliteral +| 21 = @characterliteral +| 22 = @stringliteral +| 23 = @nullliteral +| 24 = @mulexpr +| 25 = @divexpr +| 26 = @remexpr +| 27 = @addexpr +| 28 = @subexpr +| 29 = @lshiftexpr +| 30 = @rshiftexpr +| 31 = @urshiftexpr +| 32 = @andbitexpr +| 33 = @orbitexpr +| 34 = @xorbitexpr +| 35 = @andlogicalexpr +| 36 = @orlogicalexpr +| 37 = @ltexpr +| 38 = @gtexpr +| 39 = @leexpr +| 40 = @geexpr +| 41 = @eqexpr +| 42 = @neexpr +| 43 = @postincexpr +| 44 = @postdecexpr +| 45 = @preincexpr +| 46 = @predecexpr +| 47 = @minusexpr +| 48 = @plusexpr +| 49 = @bitnotexpr +| 50 = @lognotexpr +| 51 = @castexpr +| 52 = @newexpr +| 53 = @conditionalexpr +| 54 = @parexpr // deprecated +| 55 = @instanceofexpr +| 56 = @localvariabledeclexpr +| 57 = @typeliteral +| 58 = @thisaccess +| 59 = @superaccess +| 60 = @varaccess +| 61 = @methodaccess +| 62 = @unannotatedtypeaccess +| 63 = @arraytypeaccess +| 64 = @packageaccess +| 65 = @wildcardtypeaccess +| 66 = @declannotation +| 67 = @uniontypeaccess +| 68 = @lambdaexpr +| 69 = @memberref +| 70 = @annotatedtypeaccess +| 71 = @typeannotation +| 72 = @intersectiontypeaccess +| 73 = @switchexpr +; + +@classinstancexpr = @newexpr | @lambdaexpr | @memberref + +@annotation = @declannotation | @typeannotation +@typeaccess = @unannotatedtypeaccess | @annotatedtypeaccess + +@assignment = @assignexpr + | @assignop; + +@unaryassignment = @postincexpr + | @postdecexpr + | @preincexpr + | @predecexpr; + +@assignop = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + | @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + | @assignurshiftexpr; + +@literal = @booleanliteral + | @integerliteral + | @longliteral + | @floatingpointliteral + | @doubleliteral + | @characterliteral + | @stringliteral + | @nullliteral; + +@binaryexpr = @mulexpr + | @divexpr + | @remexpr + | @addexpr + | @subexpr + | @lshiftexpr + | @rshiftexpr + | @urshiftexpr + | @andbitexpr + | @orbitexpr + | @xorbitexpr + | @andlogicalexpr + | @orlogicalexpr + | @ltexpr + | @gtexpr + | @leexpr + | @geexpr + | @eqexpr + | @neexpr; + +@unaryexpr = @postincexpr + | @postdecexpr + | @preincexpr + | @predecexpr + | @minusexpr + | @plusexpr + | @bitnotexpr + | @lognotexpr; + +@caller = @classinstancexpr + | @methodaccess + | @constructorinvocationstmt + | @superconstructorinvocationstmt; + +callableBinding( + unique int callerid: @caller ref, + int callee: @callable ref +); + +memberRefBinding( + unique int id: @expr ref, + int callable: @callable ref +); + +@exprparent = @stmt | @expr | @callable | @field | @fielddecl | @class | @interface | @param | @localvar | @typevariable; + +variableBinding( + unique int expr: @varaccess ref, + int variable: @variable ref +); + +@variable = @localscopevariable | @field; + +@localscopevariable = @localvar | @param; + +localvars( + unique int id: @localvar, + string nodeName: string ref, + int typeid: @type ref, + int parentid: @localvariabledeclexpr ref +); + +@namedexprorstmt = @breakstmt + | @continuestmt + | @labeledstmt + | @literal; + +namestrings( + string name: string ref, + string value: string ref, + unique int parent: @namedexprorstmt ref +); + +/* + * Modules + */ + +#keyset[name] +modules( + unique int id: @module, + string name: string ref +); + +isOpen( + int id: @module ref +); + +#keyset[fileId] +cumodule( + int fileId: @file ref, + int moduleId: @module ref +); + +@directive = @requires + | @exports + | @opens + | @uses + | @provides + +#keyset[directive] +directives( + int id: @module ref, + int directive: @directive ref +); + +requires( + unique int id: @requires, + int target: @module ref +); + +isTransitive( + int id: @requires ref +); + +isStatic( + int id: @requires ref +); + +exports( + unique int id: @exports, + int target: @package ref +); + +exportsTo( + int id: @exports ref, + int target: @module ref +); + +opens( + unique int id: @opens, + int target: @package ref +); + +opensTo( + int id: @opens ref, + int target: @module ref +); + +uses( + unique int id: @uses, + string serviceInterface: string ref +); + +provides( + unique int id: @provides, + string serviceInterface: string ref +); + +providesWith( + int id: @provides ref, + string serviceImpl: string ref +); + +/* + * Javadoc + */ + +javadoc( + unique int id: @javadoc +); + +isNormalComment( + int commentid : @javadoc ref +); + +isEolComment( + int commentid : @javadoc ref +); + +hasJavadoc( + int documentableid: @member ref, + int javadocid: @javadoc ref +); + +#keyset[parentid,idx] +javadocTag( + unique int id: @javadocTag, + string name: string ref, + int parentid: @javadocParent ref, + int idx: int ref +); + +#keyset[parentid,idx] +javadocText( + unique int id: @javadocText, + string text: string ref, + int parentid: @javadocParent ref, + int idx: int ref +); + +@javadocParent = @javadoc | @javadocTag; +@javadocElement = @javadocTag | @javadocText; + +@typeorpackage = @type | @package; + +@typeorcallable = @type | @callable; +@classorinterface = @interface | @class; +@boundedtype = @typevariable | @wildcard; +@reftype = @classorinterface | @array | @boundedtype; +@classorarray = @class | @array; +@type = @primitive | @reftype; +@callable = @method | @constructor; +@element = @file | @package | @primitive | @class | @interface | @method | @constructor | @modifier | @param | @exception | @field | + @annotation | @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl; + +@modifiable = @member_modifiable| @param | @localvar ; + +@member_modifiable = @class | @interface | @method | @constructor | @field ; + +@member = @method | @constructor | @field | @reftype ; + +@locatable = @file | @class | @interface | @fielddecl | @field | @constructor | @method | @param | @exception + | @boundedtype | @typebound | @array | @primitive + | @import | @stmt | @expr | @localvar | @javadoc | @javadocTag | @javadocText + | @xmllocatable; + +@top = @element | @locatable | @folder; + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +/* + * configuration files with key value pairs + */ + +configs( + unique int id: @config +); + +configNames( + unique int id: @configName, + int config: @config ref, + string name: string ref +); + +configValues( + unique int id: @configValue, + int config: @config ref, + string value: string ref +); + +configLocations( + int locatable: @configLocatable ref, + int location: @location_default ref +); + +@configLocatable = @config | @configName | @configValue; diff --git a/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/semmlecode.dbscheme b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/semmlecode.dbscheme new file mode 100755 index 00000000000..b4e689c9042 --- /dev/null +++ b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/semmlecode.dbscheme @@ -0,0 +1,987 @@ +/** + * An invocation of the compiler. Note that more than one file may be + * compiled per invocation. For example, this command compiles three + * source files: + * + * javac A.java B.java C.java + * + * The `id` simply identifies the invocation, while `cwd` is the working + * directory from which the compiler was invoked. + */ +compilations( + /** + * An invocation of the compiler. Note that more than one file may + * be compiled per invocation. For example, this command compiles + * three source files: + * + * javac A.java B.java C.java + */ + unique int id : @compilation, + string cwd : string ref +); + +/** + * The arguments that were passed to the extractor for a compiler + * invocation. If `id` is for the compiler invocation + * + * javac A.java B.java C.java + * + * then typically there will be rows for + * + * num | arg + * --- | --- + * 0 | *path to extractor* + * 1 | `--javac-args` + * 2 | A.java + * 3 | B.java + * 4 | C.java + */ +#keyset[id, num] +compilation_args( + int id : @compilation ref, + int num : int ref, + string arg : string ref +); + +/** + * The source files that are compiled by a compiler invocation. + * If `id` is for the compiler invocation + * + * javac A.java B.java C.java + * + * then there will be rows for + * + * num | arg + * --- | --- + * 0 | A.java + * 1 | B.java + * 2 | C.java + */ +#keyset[id, num] +compilation_compiling_files( + int id : @compilation ref, + int num : int ref, + int file : @file ref +); + +/** + * The time taken by the extractor for a compiler invocation. + * + * For each file `num`, there will be rows for + * + * kind | seconds + * ---- | --- + * 1 | CPU seconds used by the extractor frontend + * 2 | Elapsed seconds during the extractor frontend + * 3 | CPU seconds used by the extractor backend + * 4 | Elapsed seconds during the extractor backend + */ +#keyset[id, num, kind] +compilation_time( + int id : @compilation ref, + int num : int ref, + /* kind: + 1 = frontend_cpu_seconds + 2 = frontend_elapsed_seconds + 3 = extractor_cpu_seconds + 4 = extractor_elapsed_seconds + */ + int kind : int ref, + float seconds : float ref +); + +/** + * An error or warning generated by the extractor. + * The diagnostic message `diagnostic` was generated during compiler + * invocation `compilation`, and is the `file_number_diagnostic_number`th + * message generated while extracting the `file_number`th file of that + * invocation. + */ +#keyset[compilation, file_number, file_number_diagnostic_number] +diagnostic_for( + unique int diagnostic : @diagnostic ref, + int compilation : @compilation ref, + int file_number : int ref, + int file_number_diagnostic_number : int ref +); + +/** + * If extraction was successful, then `cpu_seconds` and + * `elapsed_seconds` are the CPU time and elapsed time (respectively) + * that extraction took for compiler invocation `id`. + */ +compilation_finished( + unique int id : @compilation ref, + float cpu_seconds : float ref, + float elapsed_seconds : float ref +); + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/* + * External artifacts + */ + +externalData( + int id : @externalDataElement, + string path : string ref, + int column: int ref, + string value : string ref +); + +snapshotDate( + unique date snapshotDate : date ref +); + +sourceLocationPrefix( + string prefix : string ref +); + +/* + * Duplicate code + */ + +duplicateCode( + unique int id : @duplication, + string relativePath : string ref, + int equivClass : int ref +); + +similarCode( + unique int id : @similarity, + string relativePath : string ref, + int equivClass : int ref +); + +@duplication_or_similarity = @duplication | @similarity + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref +); + +/* + * SMAP + */ + +smap_header( + int outputFileId: @file ref, + string outputFilename: string ref, + string defaultStratum: string ref +); + +smap_files( + int outputFileId: @file ref, + string stratum: string ref, + int inputFileNum: int ref, + string inputFileName: string ref, + int inputFileId: @file ref +); + +smap_lines( + int outputFileId: @file ref, + string stratum: string ref, + int inputFileNum: int ref, + int inputStartLine: int ref, + int inputLineCount: int ref, + int outputStartLine: int ref, + int outputLineIncrement: int ref +); + +/* + * Locations and files + */ + +@location = @location_default ; + +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +hasLocation( + int locatableid: @locatable ref, + int id: @location ref +); + +@sourceline = @locatable ; + +#keyset[element_id] +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +files( + unique int id: @file, + string name: string ref, + string simple: string ref, + string ext: string ref, + int fromSource: int ref // deprecated +); + +folders( + unique int id: @folder, + string name: string ref, + string simple: string ref +); + +@container = @folder | @file + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/* + * Java + */ + +cupackage( + unique int id: @file ref, + int packageid: @package ref +); + +#keyset[fileid,keyName] +jarManifestMain( + int fileid: @file ref, + string keyName: string ref, + string value: string ref +); + +#keyset[fileid,entryName,keyName] +jarManifestEntries( + int fileid: @file ref, + string entryName: string ref, + string keyName: string ref, + string value: string ref +); + +packages( + unique int id: @package, + string nodeName: string ref +); + +primitives( + unique int id: @primitive, + string nodeName: string ref +); + +modifiers( + unique int id: @modifier, + string nodeName: string ref +); + +classes( + unique int id: @class, + string nodeName: string ref, + int parentid: @package ref, + int sourceid: @class ref +); + +isRecord( + unique int id: @class ref +); + +interfaces( + unique int id: @interface, + string nodeName: string ref, + int parentid: @package ref, + int sourceid: @interface ref +); + +fielddecls( + unique int id: @fielddecl, + int parentid: @reftype ref +); + +#keyset[fieldId] #keyset[fieldDeclId,pos] +fieldDeclaredIn( + int fieldId: @field ref, + int fieldDeclId: @fielddecl ref, + int pos: int ref +); + +fields( + unique int id: @field, + string nodeName: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @field ref +); + +constrs( + unique int id: @constructor, + string nodeName: string ref, + string signature: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @constructor ref +); + +methods( + unique int id: @method, + string nodeName: string ref, + string signature: string ref, + int typeid: @type ref, + int parentid: @reftype ref, + int sourceid: @method ref +); + +#keyset[parentid,pos] +params( + unique int id: @param, + int typeid: @type ref, + int pos: int ref, + int parentid: @callable ref, + int sourceid: @param ref +); + +paramName( + unique int id: @param ref, + string nodeName: string ref +); + +isVarargsParam( + int param: @param ref +); + +exceptions( + unique int id: @exception, + int typeid: @type ref, + int parentid: @callable ref +); + +isAnnotType( + int interfaceid: @interface ref +); + +isAnnotElem( + int methodid: @method ref +); + +annotValue( + int parentid: @annotation ref, + int id2: @method ref, + unique int value: @expr ref +); + +isEnumType( + int classid: @class ref +); + +isEnumConst( + int fieldid: @field ref +); + +#keyset[parentid,pos] +typeVars( + unique int id: @typevariable, + string nodeName: string ref, + int pos: int ref, + int kind: int ref, // deprecated + int parentid: @typeorcallable ref +); + +wildcards( + unique int id: @wildcard, + string nodeName: string ref, + int kind: int ref +); + +#keyset[parentid,pos] +typeBounds( + unique int id: @typebound, + int typeid: @reftype ref, + int pos: int ref, + int parentid: @boundedtype ref +); + +#keyset[parentid,pos] +typeArgs( + int argumentid: @reftype ref, + int pos: int ref, + int parentid: @typeorcallable ref +); + +isParameterized( + int memberid: @member ref +); + +isRaw( + int memberid: @member ref +); + +erasure( + unique int memberid: @member ref, + int erasureid: @member ref +); + +#keyset[classid] #keyset[parent] +isAnonymClass( + int classid: @class ref, + int parent: @classinstancexpr ref +); + +#keyset[classid] #keyset[parent] +isLocalClass( + int classid: @class ref, + int parent: @localclassdeclstmt ref +); + +isDefConstr( + int constructorid: @constructor ref +); + +#keyset[exprId] +lambdaKind( + int exprId: @lambdaexpr ref, + int bodyKind: int ref +); + +arrays( + unique int id: @array, + string nodeName: string ref, + int elementtypeid: @type ref, + int dimension: int ref, + int componenttypeid: @type ref +); + +enclInReftype( + unique int child: @reftype ref, + int parent: @reftype ref +); + +extendsReftype( + int id1: @reftype ref, + int id2: @classorinterface ref +); + +implInterface( + int id1: @classorarray ref, + int id2: @interface ref +); + +permits( + int id1: @classorinterface ref, + int id2: @classorinterface ref +); + +hasModifier( + int id1: @modifiable ref, + int id2: @modifier ref +); + +imports( + unique int id: @import, + int holder: @typeorpackage ref, + string name: string ref, + int kind: int ref +); + +#keyset[parent,idx] +stmts( + unique int id: @stmt, + int kind: int ref, + int parent: @stmtparent ref, + int idx: int ref, + int bodydecl: @callable ref +); + +@stmtparent = @callable | @stmt | @switchexpr; + +case @stmt.kind of + 0 = @block +| 1 = @ifstmt +| 2 = @forstmt +| 3 = @enhancedforstmt +| 4 = @whilestmt +| 5 = @dostmt +| 6 = @trystmt +| 7 = @switchstmt +| 8 = @synchronizedstmt +| 9 = @returnstmt +| 10 = @throwstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @emptystmt +| 14 = @exprstmt +| 15 = @labeledstmt +| 16 = @assertstmt +| 17 = @localvariabledeclstmt +| 18 = @localclassdeclstmt +| 19 = @constructorinvocationstmt +| 20 = @superconstructorinvocationstmt +| 21 = @case +| 22 = @catchclause +| 23 = @yieldstmt +; + +#keyset[parent,idx] +exprs( + unique int id: @expr, + int kind: int ref, + int typeid: @type ref, + int parent: @exprparent ref, + int idx: int ref +); + +callableEnclosingExpr( + unique int id: @expr ref, + int callable_id: @callable ref +); + +statementEnclosingExpr( + unique int id: @expr ref, + int statement_id: @stmt ref +); + +isParenthesized( + unique int id: @expr ref, + int parentheses: int ref +); + +case @expr.kind of + 1 = @arrayaccess +| 2 = @arraycreationexpr +| 3 = @arrayinit +| 4 = @assignexpr +| 5 = @assignaddexpr +| 6 = @assignsubexpr +| 7 = @assignmulexpr +| 8 = @assigndivexpr +| 9 = @assignremexpr +| 10 = @assignandexpr +| 11 = @assignorexpr +| 12 = @assignxorexpr +| 13 = @assignlshiftexpr +| 14 = @assignrshiftexpr +| 15 = @assignurshiftexpr +| 16 = @booleanliteral +| 17 = @integerliteral +| 18 = @longliteral +| 19 = @floatingpointliteral +| 20 = @doubleliteral +| 21 = @characterliteral +| 22 = @stringliteral +| 23 = @nullliteral +| 24 = @mulexpr +| 25 = @divexpr +| 26 = @remexpr +| 27 = @addexpr +| 28 = @subexpr +| 29 = @lshiftexpr +| 30 = @rshiftexpr +| 31 = @urshiftexpr +| 32 = @andbitexpr +| 33 = @orbitexpr +| 34 = @xorbitexpr +| 35 = @andlogicalexpr +| 36 = @orlogicalexpr +| 37 = @ltexpr +| 38 = @gtexpr +| 39 = @leexpr +| 40 = @geexpr +| 41 = @eqexpr +| 42 = @neexpr +| 43 = @postincexpr +| 44 = @postdecexpr +| 45 = @preincexpr +| 46 = @predecexpr +| 47 = @minusexpr +| 48 = @plusexpr +| 49 = @bitnotexpr +| 50 = @lognotexpr +| 51 = @castexpr +| 52 = @newexpr +| 53 = @conditionalexpr +| 54 = @parexpr // deprecated +| 55 = @instanceofexpr +| 56 = @localvariabledeclexpr +| 57 = @typeliteral +| 58 = @thisaccess +| 59 = @superaccess +| 60 = @varaccess +| 61 = @methodaccess +| 62 = @unannotatedtypeaccess +| 63 = @arraytypeaccess +| 64 = @packageaccess +| 65 = @wildcardtypeaccess +| 66 = @declannotation +| 67 = @uniontypeaccess +| 68 = @lambdaexpr +| 69 = @memberref +| 70 = @annotatedtypeaccess +| 71 = @typeannotation +| 72 = @intersectiontypeaccess +| 73 = @switchexpr +; + +@classinstancexpr = @newexpr | @lambdaexpr | @memberref + +@annotation = @declannotation | @typeannotation +@typeaccess = @unannotatedtypeaccess | @annotatedtypeaccess + +@assignment = @assignexpr + | @assignop; + +@unaryassignment = @postincexpr + | @postdecexpr + | @preincexpr + | @predecexpr; + +@assignop = @assignaddexpr + | @assignsubexpr + | @assignmulexpr + | @assigndivexpr + | @assignremexpr + | @assignandexpr + | @assignorexpr + | @assignxorexpr + | @assignlshiftexpr + | @assignrshiftexpr + | @assignurshiftexpr; + +@literal = @booleanliteral + | @integerliteral + | @longliteral + | @floatingpointliteral + | @doubleliteral + | @characterliteral + | @stringliteral + | @nullliteral; + +@binaryexpr = @mulexpr + | @divexpr + | @remexpr + | @addexpr + | @subexpr + | @lshiftexpr + | @rshiftexpr + | @urshiftexpr + | @andbitexpr + | @orbitexpr + | @xorbitexpr + | @andlogicalexpr + | @orlogicalexpr + | @ltexpr + | @gtexpr + | @leexpr + | @geexpr + | @eqexpr + | @neexpr; + +@unaryexpr = @postincexpr + | @postdecexpr + | @preincexpr + | @predecexpr + | @minusexpr + | @plusexpr + | @bitnotexpr + | @lognotexpr; + +@caller = @classinstancexpr + | @methodaccess + | @constructorinvocationstmt + | @superconstructorinvocationstmt; + +callableBinding( + unique int callerid: @caller ref, + int callee: @callable ref +); + +memberRefBinding( + unique int id: @expr ref, + int callable: @callable ref +); + +@exprparent = @stmt | @expr | @callable | @field | @fielddecl | @class | @interface | @param | @localvar | @typevariable; + +variableBinding( + unique int expr: @varaccess ref, + int variable: @variable ref +); + +@variable = @localscopevariable | @field; + +@localscopevariable = @localvar | @param; + +localvars( + unique int id: @localvar, + string nodeName: string ref, + int typeid: @type ref, + int parentid: @localvariabledeclexpr ref +); + +@namedexprorstmt = @breakstmt + | @continuestmt + | @labeledstmt + | @literal; + +namestrings( + string name: string ref, + string value: string ref, + unique int parent: @namedexprorstmt ref +); + +/* + * Modules + */ + +#keyset[name] +modules( + unique int id: @module, + string name: string ref +); + +isOpen( + int id: @module ref +); + +#keyset[fileId] +cumodule( + int fileId: @file ref, + int moduleId: @module ref +); + +@directive = @requires + | @exports + | @opens + | @uses + | @provides + +#keyset[directive] +directives( + int id: @module ref, + int directive: @directive ref +); + +requires( + unique int id: @requires, + int target: @module ref +); + +isTransitive( + int id: @requires ref +); + +isStatic( + int id: @requires ref +); + +exports( + unique int id: @exports, + int target: @package ref +); + +exportsTo( + int id: @exports ref, + int target: @module ref +); + +opens( + unique int id: @opens, + int target: @package ref +); + +opensTo( + int id: @opens ref, + int target: @module ref +); + +uses( + unique int id: @uses, + string serviceInterface: string ref +); + +provides( + unique int id: @provides, + string serviceInterface: string ref +); + +providesWith( + int id: @provides ref, + string serviceImpl: string ref +); + +/* + * Javadoc + */ + +javadoc( + unique int id: @javadoc +); + +isNormalComment( + int commentid : @javadoc ref +); + +isEolComment( + int commentid : @javadoc ref +); + +hasJavadoc( + int documentableid: @member ref, + int javadocid: @javadoc ref +); + +#keyset[parentid,idx] +javadocTag( + unique int id: @javadocTag, + string name: string ref, + int parentid: @javadocParent ref, + int idx: int ref +); + +#keyset[parentid,idx] +javadocText( + unique int id: @javadocText, + string text: string ref, + int parentid: @javadocParent ref, + int idx: int ref +); + +@javadocParent = @javadoc | @javadocTag; +@javadocElement = @javadocTag | @javadocText; + +@typeorpackage = @type | @package; + +@typeorcallable = @type | @callable; +@classorinterface = @interface | @class; +@boundedtype = @typevariable | @wildcard; +@reftype = @classorinterface | @array | @boundedtype; +@classorarray = @class | @array; +@type = @primitive | @reftype; +@callable = @method | @constructor; +@element = @file | @package | @primitive | @class | @interface | @method | @constructor | @modifier | @param | @exception | @field | + @annotation | @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl; + +@modifiable = @member_modifiable| @param | @localvar ; + +@member_modifiable = @class | @interface | @method | @constructor | @field ; + +@member = @method | @constructor | @field | @reftype ; + +@locatable = @file | @class | @interface | @fielddecl | @field | @constructor | @method | @param | @exception + | @boundedtype | @typebound | @array | @primitive + | @import | @stmt | @expr | @localvar | @javadoc | @javadocTag | @javadocText + | @xmllocatable; + +@top = @element | @locatable | @folder; + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +/* + * configuration files with key value pairs + */ + +configs( + unique int id: @config +); + +configNames( + unique int id: @configName, + int config: @config ref, + string name: string ref +); + +configValues( + unique int id: @configValue, + int config: @config ref, + string value: string ref +); + +configLocations( + int locatable: @configLocatable ref, + int location: @location_default ref +); + +@configLocatable = @config | @configName | @configValue; diff --git a/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/upgrade.properties b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/upgrade.properties new file mode 100644 index 00000000000..6e265c89de7 --- /dev/null +++ b/java/upgrades/60a4ba1a4757a01b9dfc134179788753c1388ede/upgrade.properties @@ -0,0 +1,2 @@ +description: Java: add `permits` relation for sealed classes +compatibility: backwards diff --git a/misc/scripts/library-coverage/comment-pr.py b/misc/scripts/library-coverage/comment-pr.py index 82eff108537..d371faac08e 100644 --- a/misc/scripts/library-coverage/comment-pr.py +++ b/misc/scripts/library-coverage/comment-pr.py @@ -121,10 +121,14 @@ def get_previous_run_id(repo, run_id, pr_number): pr_repo = this_run["head_repository"] # Get all previous runs that match branch, repo and workflow name: - ids = utils.subprocess_check_output(["gh", "api", "-X", "GET", f"repos/{repo}/actions/runs", "-f", "event=pull_request", "-f", "status=success", "-f", "name=\"" + artifacts_workflow_name + "\"", "--jq", - f"[.workflow_runs.[] | select(.head_branch==\"{pr_branch}\" and .head_repository.full_name==\"{pr_repo}\") | {{ created_at: .created_at, run_id: .id}}] | sort_by(.created_at) | reverse | [.[].run_id]"]) + output = utils.subprocess_check_output(["gh", "api", "-X", "GET", f"repos/{repo}/actions/runs", "-f", "event=pull_request", "-f", "status=success", "-f", f"branch='{pr_branch}'", "--paginate", + "--jq", f'[.workflow_runs.[] | select(.head_repository.full_name=="{pr_repo}" and .name=="{artifacts_workflow_name}")] | sort_by(.id) | reverse | [.[].id]']) + + ids = [] + for l in [json.loads(l) for l in output.splitlines()]: + for id in l: + ids.append(id) - ids = json.loads(ids) if ids[0] != int(run_id): raise Exception( f"Expected to find {run_id} in the list of matching runs.")