@@ -507,7 +507,7 @@ defmodule Application do
507
507
of all loaded applications. Returns `nil` if
508
508
the module is not listed in any application spec.
509
509
"""
510
- @ spec get_application ( atom ) :: atom | nil
510
+ @ spec get_application ( module ) :: app | nil
511
511
def get_application ( module ) when is_atom ( module ) do
512
512
case :application . get_application ( module ) do
513
513
{ :ok , app } -> app
@@ -814,7 +814,7 @@ defmodule Application do
814
814
stick after the application is loaded and also on application reload.
815
815
"""
816
816
@ spec put_env ( app , key , value , timeout: timeout , persistent: boolean ) :: :ok
817
- def put_env ( app , key , value , opts \\ [ ] ) when is_atom ( app ) do
817
+ def put_env ( app , key , value , opts \\ [ ] ) when is_atom ( app ) and is_list ( opts ) do
818
818
maybe_warn_on_app_env_key ( app , key )
819
819
:application . set_env ( app , key , value , opts )
820
820
end
@@ -856,7 +856,7 @@ defmodule Application do
856
856
It receives the same options as `put_env/4`. Returns `:ok`.
857
857
"""
858
858
@ spec delete_env ( app , key , timeout: timeout , persistent: boolean ) :: :ok
859
- def delete_env ( app , key , opts \\ [ ] ) when is_atom ( app ) do
859
+ def delete_env ( app , key , opts \\ [ ] ) when is_atom ( app ) and is_list ( opts ) do
860
860
maybe_warn_on_app_env_key ( app , key )
861
861
:application . unset_env ( app , key , opts )
862
862
end
@@ -921,11 +921,11 @@ defmodule Application do
921
921
{ :ok , [ app ] } | { :error , term }
922
922
def ensure_all_started ( app_or_apps , type_or_opts \\ [ ] )
923
923
924
- def ensure_all_started ( app , type ) when is_atom ( type ) do
925
- ensure_all_started ( app , type: type )
924
+ def ensure_all_started ( app_or_apps , type ) when is_atom ( type ) do
925
+ ensure_all_started ( app_or_apps , type: type )
926
926
end
927
927
928
- def ensure_all_started ( app , opts ) when is_atom ( app ) do
928
+ def ensure_all_started ( app , opts ) when is_atom ( app ) and is_list ( opts ) do
929
929
ensure_all_started ( [ app ] , opts )
930
930
end
931
931
@@ -1056,7 +1056,8 @@ defmodule Application do
1056
1056
Returns a list with information about the applications which are currently running.
1057
1057
"""
1058
1058
@ spec started_applications ( timeout ) :: [ { app , description :: charlist ( ) , vsn :: charlist ( ) } ]
1059
- def started_applications ( timeout \\ 5000 ) do
1059
+ def started_applications ( timeout \\ 5000 )
1060
+ when timeout == :infinity or ( is_integer ( timeout ) and timeout >= 0 ) do
1060
1061
:application . which_applications ( timeout )
1061
1062
end
1062
1063
0 commit comments